@@ -16,6 +16,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
16
16
import { Extensions , IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry' ;
17
17
import { EditorExtensionsRegistry } from 'vs/editor/browser/editorExtensions' ;
18
18
import { MenuId , MenuRegistry , isIMenuItem } from 'vs/platform/actions/common/actions' ;
19
+ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
19
20
20
21
export class ConfigureLanguageBasedSettingsAction extends Action {
21
22
@@ -80,17 +81,20 @@ CommandsRegistry.registerCommand({
80
81
} ) ;
81
82
82
83
//#region --- Register a command to get all actions from the command palette
83
- CommandsRegistry . registerCommand ( '_getAllCommands' , function ( ) {
84
- const actions : { command : string ; label : string ; precondition ?: string } [ ] = [ ] ;
84
+ CommandsRegistry . registerCommand ( '_getAllCommands' , function ( accessor ) {
85
+ const keybindingService = accessor . get ( IKeybindingService ) ;
86
+ const actions : { command : string ; label : string ; precondition ?: string ; keybinding : string } [ ] = [ ] ;
85
87
for ( const editorAction of EditorExtensionsRegistry . getEditorActions ( ) ) {
86
- actions . push ( { command : editorAction . id , label : editorAction . label , precondition : editorAction . precondition ?. serialize ( ) } ) ;
88
+ const keybinding = keybindingService . lookupKeybinding ( editorAction . id ) ;
89
+ actions . push ( { command : editorAction . id , label : editorAction . label , precondition : editorAction . precondition ?. serialize ( ) , keybinding : keybinding ?. getLabel ( ) ?? 'Not set' } ) ;
87
90
}
88
91
for ( const menuItem of MenuRegistry . getMenuItems ( MenuId . CommandPalette ) ) {
89
92
if ( isIMenuItem ( menuItem ) ) {
90
93
const title = typeof menuItem . command . title === 'string' ? menuItem . command . title : menuItem . command . title . value ;
91
94
const category = menuItem . command . category ? typeof menuItem . command . category === 'string' ? menuItem . command . category : menuItem . command . category . value : undefined ;
92
95
const label = category ? `${ category } : ${ title } ` : title ;
93
- actions . push ( { command : menuItem . command . id , label, precondition : menuItem . when ?. serialize ( ) } ) ;
96
+ const keybinding = keybindingService . lookupKeybinding ( menuItem . command . id ) ;
97
+ actions . push ( { command : menuItem . command . id , label, precondition : menuItem . when ?. serialize ( ) , keybinding : keybinding ?. getLabel ( ) ?? 'Not set' } ) ;
94
98
}
95
99
}
96
100
return actions ;
0 commit comments