@@ -92,6 +92,13 @@ class InspectContextKeysAction extends Action2 {
92
92
}
93
93
}
94
94
95
+ interface IScreencastKeyboardOptions {
96
+ readonly showKeys ?: boolean ;
97
+ readonly showCommands ?: boolean ;
98
+ readonly showCommandGroups ?: boolean ;
99
+ readonly showSingleEditorCursorMoves ?: boolean ;
100
+ }
101
+
95
102
class ToggleScreencastModeAction extends Action2 {
96
103
97
104
static disposable : IDisposable | undefined ;
@@ -259,11 +266,12 @@ class ToggleScreencastModeAction extends Action2 {
259
266
return ;
260
267
}
261
268
269
+ const options = configurationService . getValue < IScreencastKeyboardOptions > ( 'screencastMode.keyboardOptions' ) ;
262
270
const event = new StandardKeyboardEvent ( e ) ;
263
271
const shortcut = keybindingService . softDispatch ( event , event . target ) ;
264
272
265
273
// Hide the single arrow key pressed
266
- if ( shortcut . kind === ResultKind . KbFound && shortcut . commandId && configurationService . getValue ( 'screencastMode.hideSingleEditorCursorMoves' ) && (
274
+ if ( shortcut . kind === ResultKind . KbFound && shortcut . commandId && ! ( options . showSingleEditorCursorMoves ?? true ) && (
267
275
[ 'cursorLeft' , 'cursorRight' , 'cursorUp' , 'cursorDown' ] . includes ( shortcut . commandId ) )
268
276
) {
269
277
return ;
@@ -280,18 +288,17 @@ class ToggleScreencastModeAction extends Action2 {
280
288
length = 0 ;
281
289
}
282
290
283
- const format = configurationService . getValue < 'keys' | 'command' | 'commandWithGroup' | 'commandAndKeys' | 'commandWithGroupAndKeys' > ( 'screencastMode.keyboardShortcutsFormat' ) ;
284
291
const keybinding = keybindingService . resolveKeyboardEvent ( event ) ;
285
292
const command = ( this . _isKbFound ( shortcut ) && shortcut . commandId ) ? MenuRegistry . getCommand ( shortcut . commandId ) : null ;
286
293
287
- let titleLabel = '' ;
294
+ let commandAndGroupLabel = '' ;
288
295
let keyLabel : string | undefined | null = keybinding . getLabel ( ) ;
289
296
290
297
if ( command ) {
291
- titleLabel = typeof command . title === 'string' ? command . title : command . title . value ;
298
+ commandAndGroupLabel = typeof command . title === 'string' ? command . title : command . title . value ;
292
299
293
- if ( ( format === 'commandWithGroup' || format === 'commandWithGroupAndKeys' ) && command . category ) {
294
- titleLabel = `${ typeof command . category === 'string' ? command . category : command . category . value } : ${ titleLabel } ` ;
300
+ if ( ( options . showCommandGroups ?? false ) && command . category ) {
301
+ commandAndGroupLabel = `${ typeof command . category === 'string' ? command . category : command . category . value } : ${ commandAndGroupLabel } ` ;
295
302
}
296
303
297
304
if ( this . _isKbFound ( shortcut ) && shortcut . commandId ) {
@@ -304,13 +311,11 @@ class ToggleScreencastModeAction extends Action2 {
304
311
}
305
312
}
306
313
307
- const onlyKeyboardShortcuts = configurationService . getValue ( 'screencastMode.onlyKeyboardShortcuts' ) ;
308
-
309
- if ( format !== 'keys' && titleLabel && ! onlyKeyboardShortcuts ) {
310
- append ( keyboardMarker , $ ( 'span.title' , { } , `${ titleLabel } ` ) ) ;
314
+ if ( ( options . showCommands ?? true ) && commandAndGroupLabel ) {
315
+ append ( keyboardMarker , $ ( 'span.title' , { } , `${ commandAndGroupLabel } ` ) ) ;
311
316
}
312
317
313
- if ( onlyKeyboardShortcuts || ! titleLabel || ( this . _isKbFound ( shortcut ) && shortcut . commandId ) && ( format === 'keys' || format === 'commandAndKeys' || format === 'commandWithGroupAndKeys' ) ) {
318
+ if ( options . showKeys ?? true ) {
314
319
// Fix label for arrow keys
315
320
keyLabel = keyLabel ?. replace ( 'UpArrow' , '↑' )
316
321
?. replace ( 'DownArrow' , '↓' )
@@ -421,27 +426,38 @@ configurationRegistry.registerConfiguration({
421
426
maximum : 100 ,
422
427
description : localize ( 'screencastMode.fontSize' , "Controls the font size (in pixels) of the screencast mode keyboard." )
423
428
} ,
424
- 'screencastMode.keyboardShortcutsFormat' : {
425
- enum : [ 'keys' , 'command' , 'commandWithGroup' , 'commandAndKeys' , 'commandWithGroupAndKeys' ] ,
426
- enumDescriptions : [
427
- localize ( 'keyboardShortcutsFormat.keys' , "Keys." ) ,
428
- localize ( 'keyboardShortcutsFormat.command' , "Command title." ) ,
429
- localize ( 'keyboardShortcutsFormat.commandWithGroup' , "Command title prefixed by its group." ) ,
430
- localize ( 'keyboardShortcutsFormat.commandAndKeys' , "Command title and keys." ) ,
431
- localize ( 'keyboardShortcutsFormat.commandWithGroupAndKeys' , "Command title and keys, with the command prefixed by its group." )
432
- ] ,
433
- description : localize ( 'screencastMode.keyboardShortcutsFormat' , "Controls what is displayed in the keyboard overlay when showing shortcuts." ) ,
434
- default : 'commandAndKeys'
435
- } ,
436
- 'screencastMode.onlyKeyboardShortcuts' : {
437
- type : 'boolean' ,
438
- description : localize ( 'screencastMode.onlyKeyboardShortcuts' , "Show only keyboard shortcuts in screencast mode (do not include action names)." ) ,
439
- default : false
440
- } ,
441
- 'screencastMode.hideSingleEditorCursorMoves' : {
442
- type : 'boolean' ,
443
- description : localize ( 'screencastMode.hideSingleEditorCursorMoves' , "Hide the single editor cursor move commands in screencast mode." ) ,
444
- default : false
429
+ 'screencastMode.keyboardOptions' : {
430
+ type : 'object' ,
431
+ description : localize ( 'screencastMode.keyboardOptions.description' , "Options for customizing the keyboard overlay in screencast mode." ) ,
432
+ properties : {
433
+ 'showKeys' : {
434
+ type : 'boolean' ,
435
+ default : true ,
436
+ description : localize ( 'screencastMode.keyboardOptions.showKeys' , "Show raw keys." )
437
+ } ,
438
+ 'showCommands' : {
439
+ type : 'boolean' ,
440
+ default : true ,
441
+ description : localize ( 'screencastMode.keyboardOptions.showCommands' , "Show command names." )
442
+ } ,
443
+ 'showCommandGroups' : {
444
+ type : 'boolean' ,
445
+ default : false ,
446
+ description : localize ( 'screencastMode.keyboardOptions.showCommandGroups' , "Show command group names, when commands are also shown." )
447
+ } ,
448
+ 'showSingleEditorCursorMoves' : {
449
+ type : 'boolean' ,
450
+ default : true ,
451
+ description : localize ( 'screencastMode.keyboardOptions.showSingleEditorCursorMoves' , "Show single editor cursor move commands." )
452
+ }
453
+ } ,
454
+ default : {
455
+ 'showKeys' : true ,
456
+ 'showCommands' : true ,
457
+ 'showCommandGroups' : false ,
458
+ 'showSingleEditorCursorMoves' : true
459
+ } ,
460
+ additionalProperties : false
445
461
} ,
446
462
'screencastMode.keyboardOverlayTimeout' : {
447
463
type : 'number' ,
0 commit comments