Skip to content

Commit ea381c9

Browse files
committed
Fix releasing alt sometimes not hiding locked hovers
- CompositeMouseTracker.isMouseIn's initial state is now true, this means releasing alt without moving the mouse will not hide the hover - The current hover options are now only cleared when the hover being disposed is the active hover, this was the main cause of the problem because if current hover options is undefined while there is an active hover weird things could happen Fixes microsoft#150842
1 parent 42b35cb commit ea381c9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/vs/workbench/services/hover/browser/hoverService.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ export class HoverService implements IHoverService {
3838
const hoverDisposables = new DisposableStore();
3939
const hover = this._instantiationService.createInstance(HoverWidget, options);
4040
hover.onDispose(() => {
41-
this._currentHoverOptions = undefined;
41+
// Only clear the current options if it's the current hover, the current options help
42+
// reduce flickering when the same hover is shown multiple times
43+
if (this._currentHoverOptions === options) {
44+
this._currentHoverOptions = undefined;
45+
}
4246
hoverDisposables.dispose();
4347
});
4448
const provider = this._contextViewService as IContextViewProvider;

src/vs/workbench/services/hover/browser/hoverWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ export class HoverWidget extends Widget {
507507
}
508508

509509
class CompositeMouseTracker extends Widget {
510-
private _isMouseIn: boolean = false;
510+
private _isMouseIn: boolean = true;
511511
private _mouseTimeout: number | undefined;
512512

513513
private readonly _onMouseOut = this._register(new Emitter<void>());

0 commit comments

Comments
 (0)