@@ -10,7 +10,7 @@ import { visit } from 'vs/base/common/json';
10
10
import { setProperty } from 'vs/base/common/jsonEdit' ;
11
11
import { Constants } from 'vs/base/common/uint' ;
12
12
import { KeyCode } from 'vs/base/common/keyCodes' ;
13
- import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent' ;
13
+ import { IKeyboardEvent , StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent' ;
14
14
import { StandardTokenType } from 'vs/editor/common/modes' ;
15
15
import { DEFAULT_WORD_REGEXP } from 'vs/editor/common/model/wordHelper' ;
16
16
import { ICodeEditor , IEditorMouseEvent , MouseTargetType , IPartialEditorMouseEvent } from 'vs/editor/browser/editorBrowser' ;
@@ -33,6 +33,7 @@ import { ITextModel } from 'vs/editor/common/model';
33
33
import { dispose , IDisposable } from 'vs/base/common/lifecycle' ;
34
34
import { EditOperation } from 'vs/editor/common/core/editOperation' ;
35
35
import { basename } from 'vs/base/common/path' ;
36
+ import { domEvent } from 'vs/base/browser/event' ;
36
37
37
38
const HOVER_DELAY = 300 ;
38
39
const LAUNCH_JSON_REGEX = / \. v s c o d e \/ l a u n c h \. j s o n $ / ;
@@ -171,8 +172,9 @@ export class DebugEditorContribution implements IDebugEditorContribution {
171
172
private static readonly MEMOIZER = createMemoizer ( ) ;
172
173
173
174
private exceptionWidget : ExceptionWidget | undefined ;
174
-
175
175
private configurationWidget : FloatingClickWidget | undefined ;
176
+ private altListener : IDisposable | undefined ;
177
+ private altPressed = false ;
176
178
177
179
constructor (
178
180
private editor : ICodeEditor ,
@@ -219,7 +221,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
219
221
const stackFrame = this . debugService . getViewModel ( ) . focusedStackFrame ;
220
222
const model = this . editor . getModel ( ) ;
221
223
if ( model ) {
222
- this . _applyHoverConfiguration ( model , stackFrame ) ;
224
+ this . applyHoverConfiguration ( model , stackFrame ) ;
223
225
}
224
226
this . toggleExceptionWidget ( ) ;
225
227
this . hideHoverWidget ( ) ;
@@ -240,14 +242,38 @@ export class DebugEditorContribution implements IDebugEditorContribution {
240
242
return getWordToLineNumbersMap ( this . editor . getModel ( ) ) ;
241
243
}
242
244
243
- private _applyHoverConfiguration ( model : ITextModel , stackFrame : IStackFrame | undefined ) : void {
245
+ private applyHoverConfiguration ( model : ITextModel , stackFrame : IStackFrame | undefined ) : void {
244
246
if ( stackFrame && model . uri . toString ( ) === stackFrame . source . uri . toString ( ) ) {
245
- this . editor . updateOptions ( {
246
- hover : {
247
- enabled : false
247
+ if ( this . altListener ) {
248
+ this . altListener . dispose ( ) ;
249
+ }
250
+ // When the alt key is pressed show regular editor hover and hide the debug hover #84561
251
+ this . altListener = domEvent ( document , 'keydown' ) ( keydownEvent => {
252
+ const standardKeyboardEvent = new StandardKeyboardEvent ( keydownEvent ) ;
253
+ if ( standardKeyboardEvent . keyCode === KeyCode . Alt ) {
254
+ this . altPressed = true ;
255
+ this . hoverWidget . hide ( ) ;
256
+ this . enableEditorHover ( ) ;
257
+ const listener = domEvent ( document , 'keyup' ) ( keyupEvent => {
258
+ const standardKeyboardEvent = new StandardKeyboardEvent ( keyupEvent ) ;
259
+ if ( standardKeyboardEvent . keyCode === KeyCode . Alt ) {
260
+ this . altPressed = false ;
261
+ this . editor . updateOptions ( { hover : { enabled : false } } ) ;
262
+ listener . dispose ( ) ;
263
+ }
264
+ } ) ;
248
265
}
249
266
} ) ;
267
+
268
+ this . editor . updateOptions ( { hover : { enabled : false } } ) ;
250
269
} else {
270
+ this . enableEditorHover ( ) ;
271
+ }
272
+ }
273
+
274
+ private enableEditorHover ( ) : void {
275
+ if ( this . editor . hasModel ( ) ) {
276
+ const model = this . editor . getModel ( ) ;
251
277
let overrides = {
252
278
resource : model . uri ,
253
279
overrideIdentifier : model . getLanguageIdentifier ( ) . language
@@ -266,15 +292,15 @@ export class DebugEditorContribution implements IDebugEditorContribution {
266
292
async showHover ( range : Range , focus : boolean ) : Promise < void > {
267
293
const sf = this . debugService . getViewModel ( ) . focusedStackFrame ;
268
294
const model = this . editor . getModel ( ) ;
269
- if ( sf && model && sf . source . uri . toString ( ) === model . uri . toString ( ) ) {
295
+ if ( sf && model && sf . source . uri . toString ( ) === model . uri . toString ( ) && ! this . altPressed ) {
270
296
return this . hoverWidget . showAt ( range , focus ) ;
271
297
}
272
298
}
273
299
274
300
private async onFocusStackFrame ( sf : IStackFrame | undefined ) : Promise < void > {
275
301
const model = this . editor . getModel ( ) ;
276
302
if ( model ) {
277
- this . _applyHoverConfiguration ( model , sf ) ;
303
+ this . applyHoverConfiguration ( model , sf ) ;
278
304
if ( sf && sf . source . uri . toString ( ) === model . uri . toString ( ) ) {
279
305
await this . toggleExceptionWidget ( ) ;
280
306
} else {
0 commit comments