From 3028ad09238dfdbd90a172e8170b6cb66aa81cbf Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Tue, 6 Dec 2022 22:55:12 -0600 Subject: [PATCH] Fix breakpoint gutter hover while paused (#168264) Fix #130904 --- .../debug/browser/debugEditorContribution.ts | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts index 3ea12d46cd5..90976464bb3 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts @@ -243,6 +243,7 @@ export class DebugEditorContribution implements IDebugEditorContribution { private hoverPosition: Position | null = null; private mouseDown = false; private exceptionWidgetVisible: IContextKey; + private gutterIsHovered = false; private exceptionWidget: ExceptionWidget | undefined; private configurationWidget: FloatingClickWidget | undefined; @@ -298,14 +299,11 @@ export class DebugEditorContribution implements IDebugEditorContribution { this.toDispose.push(this.debugService.getViewModel().onWillUpdateViews(() => this.updateInlineValuesScheduler.schedule())); this.toDispose.push(this.debugService.getViewModel().onDidEvaluateLazyExpression(() => this.updateInlineValuesScheduler.schedule())); this.toDispose.push(this.editor.onDidChangeModel(async () => { - const stackFrame = this.debugService.getViewModel().focusedStackFrame; - const model = this.editor.getModel(); - if (model) { - this.applyHoverConfiguration(model, stackFrame); - } + this.updateHoverConfiguration(); this.toggleExceptionWidget(); this.hideHoverWidget(); this._wordToLineNumbersMap = undefined; + const stackFrame = this.debugService.getViewModel().focusedStackFrame; await this.updateInlineValueDecorations(stackFrame); })); this.toDispose.push(this.editor.onDidScrollChange(() => { @@ -332,6 +330,14 @@ export class DebugEditorContribution implements IDebugEditorContribution { return this._wordToLineNumbersMap; } + private updateHoverConfiguration(): void { + const stackFrame = this.debugService.getViewModel().focusedStackFrame; + const model = this.editor.getModel(); + if (model) { + this.applyHoverConfiguration(model, stackFrame); + } + } + private applyHoverConfiguration(model: ITextModel, stackFrame: IStackFrame | undefined): void { if (stackFrame && this.uriIdentityService.extUri.isEqual(model.uri, stackFrame.source.uri)) { if (this.altListener) { @@ -466,10 +472,21 @@ export class DebugEditorContribution implements IDebugEditorContribution { const target = mouseEvent.target; const stopKey = env.isMacintosh ? 'metaKey' : 'ctrlKey'; + if (!this.altPressed) { + if (target.type === MouseTargetType.GUTTER_GLYPH_MARGIN) { + this.editor.updateOptions({ hover: { enabled: true } }); + this.gutterIsHovered = true; + } else if (this.gutterIsHovered) { + this.gutterIsHovered = false; + this.updateHoverConfiguration(); + } + } + if (target.type === MouseTargetType.CONTENT_WIDGET && target.detail === DebugHoverWidget.ID && !(mouseEvent.event)[stopKey]) { // mouse moved on top of debug hover widget return; } + if (target.type === MouseTargetType.CONTENT_TEXT) { if (target.position && !Position.equals(target.position, this.hoverPosition)) { this.hoverPosition = target.position;