Skip to content

Commit 7a5f6f0

Browse files
committed
when the content is not focused it should not disappear
1 parent 032b14c commit 7a5f6f0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/vs/editor/contrib/hover/browser/contentHover.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ export class ContentHoverController extends Disposable {
195195

196196
private _setCurrentResult(hoverResult: HoverResult | null): void {
197197
if (this._currentResult === hoverResult) {
198-
// avoid updating the DOM to avoid resetting the user selection
198+
if (hoverResult === null && !this._widget.isFocused) {
199+
this._widget.hide();
200+
}
199201
return;
200202
}
201203
if (hoverResult && hoverResult.messages.length === 0) {
@@ -205,6 +207,9 @@ export class ContentHoverController extends Disposable {
205207
if (this._currentResult) {
206208
this._renderMessages(this._currentResult.anchor, this._currentResult.messages);
207209
} else {
210+
if (this._widget.isFocused) {
211+
return;
212+
}
208213
this._widget.hide();
209214
}
210215
}
@@ -479,6 +484,10 @@ export class ContentHoverWidget extends ResizableContentWidget {
479484
return this._hoverVisibleKey.get() ?? false;
480485
}
481486

487+
public get isFocused(): boolean {
488+
return this._hoverFocusedKey.get() ?? false;
489+
}
490+
482491
constructor(
483492
editor: ICodeEditor,
484493
@IContextKeyService contextKeyService: IContextKeyService
@@ -727,10 +736,7 @@ export class ContentHoverWidget extends ResizableContentWidget {
727736
}
728737

729738
public hide(): void {
730-
if (!this._visibleData) {
731-
return;
732-
}
733-
const stoleFocus = this._visibleData.stoleFocus;
739+
const stoleFocus = this._visibleData?.stoleFocus;
734740
this._setHoverData(undefined);
735741
this._resizableNode.maxSize = new dom.Dimension(Infinity, Infinity);
736742
this._resizableNode.clearSashHoverState();

0 commit comments

Comments
 (0)