Skip to content

Commit 2a5b54b

Browse files
authored
Include commands from default keybindings in _getAllCommands (#238163)
1 parent 0866aa7 commit 2a5b54b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/vs/workbench/contrib/preferences/browser/preferencesActions.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { MenuId, MenuRegistry, isIMenuItem } from '../../../../platform/actions/
1919
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
2020
import { isLocalizedString } from '../../../../platform/action/common/action.js';
2121
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
22+
import { KeybindingsRegistry } from '../../../../platform/keybinding/common/keybindingsRegistry.js';
2223

2324
export class ConfigureLanguageBasedSettingsAction extends Action {
2425

@@ -119,6 +120,27 @@ CommandsRegistry.registerCommand('_getAllCommands', function (accessor, filterBy
119120
});
120121
}
121122
}
123+
for (const command of KeybindingsRegistry.getDefaultKeybindings()) {
124+
if (filterByPrecondition && !contextKeyService.contextMatchesRules(command.when ?? undefined)) {
125+
continue;
126+
}
127+
128+
const keybinding = keybindingService.lookupKeybinding(command.command ?? '');
129+
if (!keybinding) {
130+
continue;
131+
}
132+
133+
if (actions.some(a => a.command === command.command)) {
134+
continue;
135+
}
136+
actions.push({
137+
command: command.command ?? '',
138+
label: command.command ?? '',
139+
keybinding: keybinding?.getLabel() ?? 'Not set',
140+
precondition: command.when?.serialize()
141+
});
142+
}
143+
122144
return actions;
123145
});
124146
//#endregion

0 commit comments

Comments
 (0)