Skip to content

Commit

Permalink
Include commands from default keybindings in _getAllCommands (#238163)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavyaus authored Jan 17, 2025
1 parent 0866aa7 commit 2a5b54b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/vs/workbench/contrib/preferences/browser/preferencesActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { MenuId, MenuRegistry, isIMenuItem } from '../../../../platform/actions/
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
import { isLocalizedString } from '../../../../platform/action/common/action.js';
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
import { KeybindingsRegistry } from '../../../../platform/keybinding/common/keybindingsRegistry.js';

export class ConfigureLanguageBasedSettingsAction extends Action {

Expand Down Expand Up @@ -119,6 +120,27 @@ CommandsRegistry.registerCommand('_getAllCommands', function (accessor, filterBy
});
}
}
for (const command of KeybindingsRegistry.getDefaultKeybindings()) {
if (filterByPrecondition && !contextKeyService.contextMatchesRules(command.when ?? undefined)) {
continue;
}

const keybinding = keybindingService.lookupKeybinding(command.command ?? '');
if (!keybinding) {
continue;
}

if (actions.some(a => a.command === command.command)) {
continue;
}
actions.push({
command: command.command ?? '',
label: command.command ?? '',
keybinding: keybinding?.getLabel() ?? 'Not set',
precondition: command.when?.serialize()
});
}

return actions;
});
//#endregion

0 comments on commit 2a5b54b

Please sign in to comment.