Fix breakpoint gutter hover while paused (#168264)

Fix #130904
This commit is contained in:
Rob Lourens 2022-12-06 22:55:12 -06:00 committed by GitHub
parent 1c85aeab67
commit 3028ad0923
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -243,6 +243,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
private hoverPosition: Position | null = null;
private mouseDown = false;
private exceptionWidgetVisible: IContextKey<boolean>;
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 && !(<any>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;