Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing escape does not close hover #236203

Open
wants to merge 2 commits into
base: release/1.96
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions src/vs/editor/contrib/hover/browser/contentHoverController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,17 @@ export class ContentHoverController extends Disposable implements IEditorContrib
sticky: hoverOpts.sticky,
hidingDelay: hoverOpts.hidingDelay
};
if (hoverOpts.enabled) {
this._listenersStore.add(this._editor.onMouseDown((e: IEditorMouseEvent) => this._onEditorMouseDown(e)));
this._listenersStore.add(this._editor.onMouseUp(() => this._onEditorMouseUp()));
this._listenersStore.add(this._editor.onMouseMove((e: IEditorMouseEvent) => this._onEditorMouseMove(e)));
this._listenersStore.add(this._editor.onKeyDown((e: IKeyboardEvent) => this._onKeyDown(e)));
this._listenersStore.add(this._editor.onMouseLeave((e) => this._onEditorMouseLeave(e)));
this._listenersStore.add(this._editor.onDidChangeModel(() => this._cancelSchedulerAndHide()));
this._listenersStore.add(this._editor.onDidChangeModelContent(() => this._cancelScheduler()));
this._listenersStore.add(this._editor.onDidScrollChange((e: IScrollEvent) => this._onEditorScrollChanged(e)));
} else {
if (!hoverOpts.enabled) {
this._cancelSchedulerAndHide();
}
this._listenersStore.add(this._editor.onMouseDown((e: IEditorMouseEvent) => this._onEditorMouseDown(e)));
this._listenersStore.add(this._editor.onMouseUp(() => this._onEditorMouseUp()));
this._listenersStore.add(this._editor.onMouseMove((e: IEditorMouseEvent) => this._onEditorMouseMove(e)));
this._listenersStore.add(this._editor.onKeyDown((e: IKeyboardEvent) => this._onKeyDown(e)));
this._listenersStore.add(this._editor.onMouseLeave((e) => this._onEditorMouseLeave(e)));
this._listenersStore.add(this._editor.onDidChangeModel(() => this._cancelSchedulerAndHide()));
this._listenersStore.add(this._editor.onDidChangeModelContent(() => this._cancelScheduler()));
this._listenersStore.add(this._editor.onDidScrollChange((e: IScrollEvent) => this._onEditorScrollChanged(e)));
}

private _unhookListeners(): void {
Expand Down Expand Up @@ -229,9 +228,11 @@ export class ContentHoverController extends Disposable implements IEditorContrib
if (!mouseEvent) {
return;
}
const contentWidget: ContentHoverWidgetWrapper = this._getOrCreateContentWidget();
if (contentWidget.showsOrWillShow(mouseEvent)) {
return;
if (this._hoverSettings.enabled) {
const contentWidget: ContentHoverWidgetWrapper = this._getOrCreateContentWidget();
if (contentWidget.showsOrWillShow(mouseEvent)) {
return;
}
}
if (_sticky) {
return;
Expand Down
Loading