Skip to content

Commit 9c0ca04

Browse files
committed
debug: smoother toggle between debug and editor hover
fixes microsoft#84561
1 parent ff7a107 commit 9c0ca04

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import { dispose, IDisposable } from 'vs/base/common/lifecycle';
3434
import { EditOperation } from 'vs/editor/common/core/editOperation';
3535
import { basename } from 'vs/base/common/path';
3636
import { domEvent } from 'vs/base/browser/event';
37+
import { ModesHoverController } from 'vs/editor/contrib/hover/hover';
38+
import { HoverStartMode } from 'vs/editor/contrib/hover/hoverOperation';
3739

3840
const HOVER_DELAY = 300;
3941
const LAUNCH_JSON_REGEX = /\.vscode\/launch\.json$/;
@@ -252,14 +254,24 @@ export class DebugEditorContribution implements IDebugEditorContribution {
252254
const standardKeyboardEvent = new StandardKeyboardEvent(keydownEvent);
253255
if (standardKeyboardEvent.keyCode === KeyCode.Alt) {
254256
this.altPressed = true;
257+
const debugHoverWasVisible = this.hoverWidget.isVisible();
255258
this.hoverWidget.hide();
256259
this.enableEditorHover();
260+
if (debugHoverWasVisible && this.hoverRange) {
261+
// If the debug hover was visible immediately show the editor hover for the alt transition to be smooth
262+
const hoverController = this.editor.getContribution<ModesHoverController>(ModesHoverController.ID);
263+
hoverController.showContentHover(this.hoverRange, HoverStartMode.Immediate, false);
264+
}
265+
257266
const listener = domEvent(document, 'keyup')(keyupEvent => {
258267
const standardKeyboardEvent = new StandardKeyboardEvent(keyupEvent);
259268
if (standardKeyboardEvent.keyCode === KeyCode.Alt) {
260269
this.altPressed = false;
261270
this.editor.updateOptions({ hover: { enabled: false } });
262271
listener.dispose();
272+
if (this.hoverRange && debugHoverWasVisible) {
273+
this.showHover(this.hoverRange, false);
274+
}
263275
}
264276
});
265277
}

0 commit comments

Comments
 (0)