From ad44345dd8b99ba59982da0bc71dc09002d3552e Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Fri, 7 Oct 2022 15:23:22 -0700 Subject: [PATCH 1/2] Refactor DebugHover so it stays properly in place Fix #151019 --- .../debug/browser/debugEditorActions.ts | 40 ++-- .../debug/browser/debugEditorContribution.ts | 19 +- .../contrib/debug/browser/debugHover.ts | 222 +++++++++++------- .../debug/browser/media/debugHover.css | 1 - .../workbench/contrib/debug/common/debug.ts | 4 +- 5 files changed, 168 insertions(+), 118 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts b/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts index 9687e574a1a6c..021e9b5229564 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts @@ -3,29 +3,28 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as nls from 'vs/nls'; -import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes'; -import { Range } from 'vs/editor/common/core/range'; +import { getDomNodePagePosition } from 'vs/base/browser/dom'; +import { Action } from 'vs/base/common/actions'; +import { KeyChord, KeyCode, KeyMod } from 'vs/base/common/keyCodes'; +import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { EditorAction, EditorAction2, IActionOptions, registerEditorAction } from 'vs/editor/browser/editorExtensions'; +import { Position } from 'vs/editor/common/core/position'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; -import { registerEditorAction, EditorAction, IActionOptions, EditorAction2 } from 'vs/editor/browser/editorExtensions'; +import { MessageController } from 'vs/editor/contrib/message/browser/messageController'; +import * as nls from 'vs/nls'; +import { Action2, MenuId, registerAction2 } from 'vs/platform/actions/common/actions'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; -import { IDebugService, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_STATE, IDebugEditorContribution, EDITOR_CONTRIBUTION_ID, BreakpointWidgetContext, BREAKPOINT_EDITOR_CONTRIBUTION_ID, IBreakpointEditorContribution, REPL_VIEW_ID, CONTEXT_STEP_INTO_TARGETS_SUPPORTED, WATCH_VIEW_ID, CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_EXCEPTION_WIDGET_VISIBLE, CONTEXT_DISASSEMBLE_REQUEST_SUPPORTED, CONTEXT_LANGUAGE_SUPPORTS_DISASSEMBLE_REQUEST, CONTEXT_FOCUSED_STACK_FRAME_HAS_INSTRUCTION_POINTER_REFERENCE, CONTEXT_CALLSTACK_ITEM_TYPE, IDebugConfiguration } from 'vs/workbench/contrib/debug/common/debug'; -import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { openBreakpointSource } from 'vs/workbench/contrib/debug/browser/breakpointsView'; +import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; +import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'; import { PanelFocusContext } from 'vs/workbench/common/contextkeys'; import { IViewsService } from 'vs/workbench/common/views'; -import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'; -import { registerAction2, MenuId, Action2 } from 'vs/platform/actions/common/actions'; -import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { openBreakpointSource } from 'vs/workbench/contrib/debug/browser/breakpointsView'; +import { BreakpointWidgetContext, BREAKPOINT_EDITOR_CONTRIBUTION_ID, CONTEXT_CALLSTACK_ITEM_TYPE, CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_DEBUG_STATE, CONTEXT_DISASSEMBLE_REQUEST_SUPPORTED, CONTEXT_EXCEPTION_WIDGET_VISIBLE, CONTEXT_FOCUSED_STACK_FRAME_HAS_INSTRUCTION_POINTER_REFERENCE, CONTEXT_IN_DEBUG_MODE, CONTEXT_LANGUAGE_SUPPORTS_DISASSEMBLE_REQUEST, CONTEXT_STEP_INTO_TARGETS_SUPPORTED, EDITOR_CONTRIBUTION_ID, IBreakpointEditorContribution, IDebugConfiguration, IDebugEditorContribution, IDebugService, REPL_VIEW_ID, WATCH_VIEW_ID } from 'vs/workbench/contrib/debug/common/debug'; import { DisassemblyViewInput } from 'vs/workbench/contrib/debug/common/disassemblyViewInput'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { MessageController } from 'vs/editor/contrib/message/browser/messageController'; -import { getDomNodePagePosition } from 'vs/base/browser/dom'; -import { Position } from 'vs/editor/common/core/position'; -import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; -import { Action } from 'vs/base/common/actions'; +import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; class ToggleBreakpointAction extends EditorAction { constructor() { @@ -321,13 +320,8 @@ class ShowDebugHoverAction extends EditorAction { if (!position || !editor.hasModel()) { return; } - const word = editor.getModel().getWordAtPosition(position); - if (!word) { - return; - } - const range = new Range(position.lineNumber, position.column, position.lineNumber, word.endColumn); - return editor.getContribution(EDITOR_CONTRIBUTION_ID)?.showHover(range, true); + return editor.getContribution(EDITOR_CONTRIBUTION_ID)?.showHover(position, true); } } diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts index 251241bb2d50a..249252a170f85 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts @@ -213,7 +213,7 @@ export class DebugEditorContribution implements IDebugEditorContribution { private toDispose: IDisposable[]; private hoverWidget: DebugHoverWidget; - private hoverRange: Range | null = null; + private hoverPosition: Position | null = null; private mouseDown = false; private exceptionWidgetVisible: IContextKey; @@ -318,10 +318,11 @@ export class DebugEditorContribution implements IDebugEditorContribution { const debugHoverWasVisible = this.hoverWidget.isVisible(); this.hoverWidget.hide(); this.enableEditorHover(); - if (debugHoverWasVisible && this.hoverRange) { + if (debugHoverWasVisible && this.hoverPosition) { // If the debug hover was visible immediately show the editor hover for the alt transition to be smooth const hoverController = this.editor.getContribution(ModesHoverController.ID); - hoverController?.showContentHover(this.hoverRange, HoverStartMode.Immediate, false); + const range = new Range(this.hoverPosition.lineNumber, this.hoverPosition.column, this.hoverPosition.lineNumber, this.hoverPosition.column); + hoverController?.showContentHover(range, HoverStartMode.Immediate, false); } const onKeyUp = new DomEmitter(document, 'keyup'); @@ -365,11 +366,11 @@ export class DebugEditorContribution implements IDebugEditorContribution { } } - async showHover(range: Range, focus: boolean): Promise { + async showHover(position: Position, focus: boolean): Promise { const sf = this.debugService.getViewModel().focusedStackFrame; const model = this.editor.getModel(); if (sf && model && this.uriIdentityService.extUri.isEqual(sf.source.uri, model.uri) && !this.altPressed) { - return this.hoverWidget.showAt(range, focus); + return this.hoverWidget.showAt(position, focus); } } @@ -391,8 +392,8 @@ export class DebugEditorContribution implements IDebugEditorContribution { private get showHoverScheduler(): RunOnceScheduler { const hoverOption = this.editor.getOption(EditorOption.hover); const scheduler = new RunOnceScheduler(() => { - if (this.hoverRange) { - this.showHover(this.hoverRange, false); + if (this.hoverPosition) { + this.showHover(this.hoverPosition, false); } }, hoverOption.delay * 2); this.toDispose.push(scheduler); @@ -443,8 +444,8 @@ export class DebugEditorContribution implements IDebugEditorContribution { return; } if (target.type === MouseTargetType.CONTENT_TEXT) { - if (target.range && !target.range.equalsRange(this.hoverRange)) { - this.hoverRange = target.range; + if (target.position && !Position.equals(target.position, this.hoverPosition)) { + this.hoverPosition = target.position; this.hideHoverScheduler.cancel(); this.showHoverScheduler.schedule(); } diff --git a/src/vs/workbench/contrib/debug/browser/debugHover.ts b/src/vs/workbench/contrib/debug/browser/debugHover.ts index 6308c2b6c5b39..556c99775a168 100644 --- a/src/vs/workbench/contrib/debug/browser/debugHover.ts +++ b/src/vs/workbench/contrib/debug/browser/debugHover.ts @@ -3,37 +3,38 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as nls from 'vs/nls'; -import * as lifecycle from 'vs/base/common/lifecycle'; -import { KeyCode } from 'vs/base/common/keyCodes'; -import { ScrollbarVisibility } from 'vs/base/common/scrollable'; import * as dom from 'vs/base/browser/dom'; import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; +import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; +import { IListAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget'; +import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement'; +import { AsyncDataTree } from 'vs/base/browser/ui/tree/asyncDataTree'; +import { IAsyncDataSource } from 'vs/base/browser/ui/tree/tree'; +import { coalesce } from 'vs/base/common/arrays'; +import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation'; +import { KeyCode } from 'vs/base/common/keyCodes'; +import * as lifecycle from 'vs/base/common/lifecycle'; +import { isMacintosh } from 'vs/base/common/platform'; +import { ScrollbarVisibility } from 'vs/base/common/scrollable'; +import { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition } from 'vs/editor/browser/editorBrowser'; import { ConfigurationChangedEvent, EditorOption } from 'vs/editor/common/config/editorOptions'; import { Position } from 'vs/editor/common/core/position'; -import { Range, IRange } from 'vs/editor/common/core/range'; -import { IContentWidget, ICodeEditor, IContentWidgetPosition, ContentWidgetPositionPreference } from 'vs/editor/browser/editorBrowser'; +import { IRange, Range } from 'vs/editor/common/core/range'; +import { ITextModel } from 'vs/editor/common/model'; +import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; +import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures'; +import * as nls from 'vs/nls'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { IDebugService, IExpression, IExpressionContainer, IStackFrame } from 'vs/workbench/contrib/debug/common/debug'; -import { Expression, Variable } from 'vs/workbench/contrib/debug/common/debugModel'; -import { renderExpressionValue } from 'vs/workbench/contrib/debug/browser/baseDebugView'; -import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement'; +import { WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService'; +import { editorHoverBackground, editorHoverBorder, editorHoverForeground } from 'vs/platform/theme/common/colorRegistry'; import { attachStylerCallback } from 'vs/platform/theme/common/styler'; import { IThemeService } from 'vs/platform/theme/common/themeService'; -import { editorHoverBackground, editorHoverBorder, editorHoverForeground } from 'vs/platform/theme/common/colorRegistry'; -import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; -import { getExactExpressionStartAndEnd } from 'vs/workbench/contrib/debug/common/debugUtils'; -import { AsyncDataTree } from 'vs/base/browser/ui/tree/asyncDataTree'; -import { IListAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget'; -import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; -import { WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService'; -import { coalesce } from 'vs/base/common/arrays'; -import { IAsyncDataSource } from 'vs/base/browser/ui/tree/tree'; -import { VariablesRenderer } from 'vs/workbench/contrib/debug/browser/variablesView'; -import { CancellationTokenSource } from 'vs/base/common/cancellation'; -import { isMacintosh } from 'vs/base/common/platform'; +import { renderExpressionValue } from 'vs/workbench/contrib/debug/browser/baseDebugView'; import { LinkDetector } from 'vs/workbench/contrib/debug/browser/linkDetector'; -import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures'; +import { VariablesRenderer } from 'vs/workbench/contrib/debug/browser/variablesView'; +import { IDebugService, IDebugSession, IExpression, IExpressionContainer, IStackFrame } from 'vs/workbench/contrib/debug/common/debug'; +import { Expression, Variable } from 'vs/workbench/contrib/debug/common/debugModel'; +import { getExactExpressionStartAndEnd } from 'vs/workbench/contrib/debug/common/debugUtils'; const $ = dom.$; @@ -69,7 +70,7 @@ export class DebugHoverWidget implements IContentWidget { static readonly ID = 'debug.hoverWidget'; // editor.IContentWidget.allowEditorOverflow - allowEditorOverflow = true; + readonly allowEditorOverflow = true; private _isVisible: boolean; private showCancellationSource?: CancellationTokenSource; @@ -84,19 +85,20 @@ export class DebugHoverWidget implements IContentWidget { private treeContainer!: HTMLElement; private toDispose: lifecycle.IDisposable[]; private scrollbar!: DomScrollableElement; + private debugHoverComputer: DebugHoverComputer; constructor( private editor: ICodeEditor, @IDebugService private readonly debugService: IDebugService, @IInstantiationService private readonly instantiationService: IInstantiationService, - @IThemeService private readonly themeService: IThemeService, - @ILanguageFeaturesService private readonly languageFeaturesService: ILanguageFeaturesService, + @IThemeService private readonly themeService: IThemeService ) { this.toDispose = []; this._isVisible = false; this.showAtPosition = null; this.positionPreference = [ContentWidgetPositionPreference.ABOVE, ContentWidgetPositionPreference.BELOW]; + this.debugHoverComputer = this.instantiationService.createInstance(DebugHoverComputer, this.editor); } private create(): void { @@ -193,7 +195,7 @@ export class DebugHoverWidget implements IContentWidget { return this.domNode; } - async showAt(range: Range, focus: boolean): Promise { + async showAt(position: Position, focus: boolean): Promise { this.showCancellationSource?.cancel(); const cancellationSource = this.showCancellationSource = new CancellationTokenSource(); const session = this.debugService.getViewModel().focusedSession; @@ -202,72 +204,28 @@ export class DebugHoverWidget implements IContentWidget { return Promise.resolve(this.hide()); } - const model = this.editor.getModel(); - const pos = range.getStartPosition(); - - let rng: IRange | undefined = undefined; - let matchingExpression: string | undefined; - - if (this.languageFeaturesService.evaluatableExpressionProvider.has(model)) { - const supports = this.languageFeaturesService.evaluatableExpressionProvider.ordered(model); - - const promises = supports.map(support => { - return Promise.resolve(support.provideEvaluatableExpression(model, pos, cancellationSource.token)).then(expression => { - return expression; - }, err => { - //onUnexpectedExternalError(err); - return undefined; - }); - }); - - const results = await Promise.all(promises).then(coalesce); - if (results.length > 0) { - matchingExpression = results[0].expression; - rng = results[0].range; - - if (!matchingExpression) { - const lineContent = model.getLineContent(pos.lineNumber); - matchingExpression = lineContent.substring(rng.startColumn - 1, rng.endColumn - 1); - } - } - - } else { // old one-size-fits-all strategy - const lineContent = model.getLineContent(pos.lineNumber); - const { start, end } = getExactExpressionStartAndEnd(lineContent, range.startColumn, range.endColumn); - - // use regex to extract the sub-expression #9821 - matchingExpression = lineContent.substring(start - 1, end); - rng = new Range(pos.lineNumber, start, pos.lineNumber, start + matchingExpression.length); - } - - if (!matchingExpression) { - return Promise.resolve(this.hide()); + const result = await this.debugHoverComputer.compute(position, cancellationSource.token); + if (this.isVisible() && !result.rangeChanged) { + return; } - let expression; - if (session.capabilities.supportsEvaluateForHovers) { - expression = new Expression(matchingExpression); - await expression.evaluate(session, this.debugService.getViewModel().focusedStackFrame, 'hover'); - } else { - const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame; - if (focusedStackFrame) { - expression = await findExpressionInStackFrame(focusedStackFrame, coalesce(matchingExpression.split('.').map(word => word.trim()))); - } + if (!result.range || cancellationSource.token.isCancellationRequested) { + this.hide(); + return; } + const expression = await this.debugHoverComputer.evaluate(session); if (cancellationSource.token.isCancellationRequested || !expression || (expression instanceof Expression && !expression.available)) { this.hide(); return; } - if (rng) { - this.highlightDecorations.set([{ - range: rng, - options: DebugHoverWidget._HOVER_HIGHLIGHT_DECORATION_OPTIONS - }]); - } + this.highlightDecorations.set([{ + range: result.range, + options: DebugHoverWidget._HOVER_HIGHLIGHT_DECORATION_OPTIONS + }]); - return this.doShow(pos, expression, focus); + return this.doShow(result.range.getStartPosition(), expression, focus); } private static readonly _HOVER_HIGHLIGHT_DECORATION_OPTIONS = ModelDecorationOptions.register({ @@ -396,3 +354,101 @@ class DebugHoverDelegate implements IListVirtualDelegate { return VariablesRenderer.ID; } } + +interface IDebugHoverComputeResult { + rangeChanged: boolean; + range?: Range; +} + +class DebugHoverComputer { + private _currentRange: Range | undefined; + private _currentExpression: string | undefined; + + constructor( + private editor: ICodeEditor, + @IDebugService private readonly debugService: IDebugService, + @ILanguageFeaturesService private readonly languageFeaturesService: ILanguageFeaturesService, + ) { } + + public async compute(position: Position, token: CancellationToken): Promise { + const session = this.debugService.getViewModel().focusedSession; + + if (!session || !this.editor.hasModel()) { + return { rangeChanged: false }; + } + + const model = this.editor.getModel(); + + const result = await this.doCompute(model, position, token); + if (!result) { + return { rangeChanged: false }; + } + + const { range, matchingExpression } = result; + const rangeChanged = this._currentRange ? + !this._currentRange.equalsRange(range) : + true; + this._currentExpression = matchingExpression; + this._currentRange = Range.lift(range); + return { rangeChanged, range: this._currentRange }; + } + + private async doCompute(model: ITextModel, position: Position, token: CancellationToken): Promise<{ range: IRange; matchingExpression: string } | null> { + if (this.languageFeaturesService.evaluatableExpressionProvider.has(model)) { + const supports = this.languageFeaturesService.evaluatableExpressionProvider.ordered(model); + + const results = coalesce(await Promise.all(supports.map(async support => { + try { + return await support.provideEvaluatableExpression(model, position, token); + } catch (err) { + return undefined; + } + }))); + + if (results.length > 0) { + let matchingExpression = results[0].expression; + const range = results[0].range; + + if (!matchingExpression) { + const lineContent = model.getLineContent(position.lineNumber); + matchingExpression = lineContent.substring(range.startColumn - 1, range.endColumn - 1); + } + + return { range, matchingExpression }; + } + } else { // old one-size-fits-all strategy + const lineContent = model.getLineContent(position.lineNumber); + const { start, end } = getExactExpressionStartAndEnd(lineContent, position.column, position.column); + + // use regex to extract the sub-expression #9821 + const matchingExpression = lineContent.substring(start - 1, end); + return { + matchingExpression, + range: new Range(position.lineNumber, start, position.lineNumber, start + matchingExpression.length) + }; + } + + return null; + } + + async evaluate(session: IDebugSession): Promise { + if (!this._currentExpression) { + throw new Error('No expression to evaluate'); + } + + if (session.capabilities.supportsEvaluateForHovers) { + const expression = new Expression(this._currentExpression); + await expression.evaluate(session, this.debugService.getViewModel().focusedStackFrame, 'hover'); + return expression; + } else { + const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame; + if (focusedStackFrame) { + return await findExpressionInStackFrame( + focusedStackFrame, + coalesce(this._currentExpression.split('.').map(word => word.trim()))); + } + } + + return undefined; + } +} diff --git a/src/vs/workbench/contrib/debug/browser/media/debugHover.css b/src/vs/workbench/contrib/debug/browser/media/debugHover.css index c523256de87c8..3a862adbe9fdb 100644 --- a/src/vs/workbench/contrib/debug/browser/media/debugHover.css +++ b/src/vs/workbench/contrib/debug/browser/media/debugHover.css @@ -5,7 +5,6 @@ .monaco-editor .debug-hover-widget { position: absolute; - margin-top: -1px; z-index: 50; animation-duration: 0.15s; animation-name: fadeIn; diff --git a/src/vs/workbench/contrib/debug/common/debug.ts b/src/vs/workbench/contrib/debug/common/debug.ts index 11c3f051a43d8..d8feb1924298b 100644 --- a/src/vs/workbench/contrib/debug/common/debug.ts +++ b/src/vs/workbench/contrib/debug/common/debug.ts @@ -13,7 +13,7 @@ import { IDisposable } from 'vs/base/common/lifecycle'; import severity from 'vs/base/common/severity'; import { URI as uri } from 'vs/base/common/uri'; import { IPosition, Position } from 'vs/editor/common/core/position'; -import { IRange, Range } from 'vs/editor/common/core/range'; +import { IRange } from 'vs/editor/common/core/range'; import * as editorCommon from 'vs/editor/common/editorCommon'; import { ITextModel as EditorIModel } from 'vs/editor/common/model'; import * as nls from 'vs/nls'; @@ -1133,7 +1133,7 @@ export const enum BreakpointWidgetContext { } export interface IDebugEditorContribution extends editorCommon.IEditorContribution { - showHover(range: Range, focus: boolean): Promise; + showHover(range: Position, focus: boolean): Promise; addLaunchConfiguration(): Promise; closeExceptionWidget(): void; } From 83db6aa639da7c83890e2b07eaa679b8f3fc265b Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Fri, 7 Oct 2022 15:25:27 -0700 Subject: [PATCH 2/2] Remove Promise.resolve --- src/vs/workbench/contrib/debug/browser/debugHover.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugHover.ts b/src/vs/workbench/contrib/debug/browser/debugHover.ts index 556c99775a168..40afc3e611e1b 100644 --- a/src/vs/workbench/contrib/debug/browser/debugHover.ts +++ b/src/vs/workbench/contrib/debug/browser/debugHover.ts @@ -40,7 +40,7 @@ const $ = dom.$; async function doFindExpression(container: IExpressionContainer, namesToFind: string[]): Promise { if (!container) { - return Promise.resolve(null); + return null; } const children = await container.getChildren(); @@ -201,7 +201,8 @@ export class DebugHoverWidget implements IContentWidget { const session = this.debugService.getViewModel().focusedSession; if (!session || !this.editor.hasModel()) { - return Promise.resolve(this.hide()); + this.hide(); + return; } const result = await this.debugHoverComputer.compute(position, cancellationSource.token); @@ -256,7 +257,7 @@ export class DebugHoverWidget implements IContentWidget { this.valueContainer.focus(); } - return Promise.resolve(undefined); + return undefined; } this.valueContainer.hidden = true;