commandsQuickAccess.js 1.4 KB

1234567891011121314151617181920212223242526
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. import { stripIcons } from '../../../base/common/iconLabels.js';
  6. import { AbstractCommandsQuickAccessProvider } from '../../../platform/quickinput/browser/commandsQuickAccess.js';
  7. export class AbstractEditorCommandsQuickAccessProvider extends AbstractCommandsQuickAccessProvider {
  8. constructor(options, instantiationService, keybindingService, commandService, telemetryService, dialogService) {
  9. super(options, instantiationService, keybindingService, commandService, telemetryService, dialogService);
  10. }
  11. getCodeEditorCommandPicks() {
  12. const activeTextEditorControl = this.activeTextEditorControl;
  13. if (!activeTextEditorControl) {
  14. return [];
  15. }
  16. const editorCommandPicks = [];
  17. for (const editorAction of activeTextEditorControl.getSupportedActions()) {
  18. editorCommandPicks.push({
  19. commandId: editorAction.id,
  20. commandAlias: editorAction.alias,
  21. label: stripIcons(editorAction.label) || editorAction.id,
  22. });
  23. }
  24. return editorCommandPicks;
  25. }
  26. }