Files
code-server/lib/vscode/src/vs/editor/contrib/quickAccess/commandsQuickAccess.ts
Joe Previte eae5d8c807 chore(vscode): update to 1.53.2
These conflicts will be resolved in the following commits. We do it this way so
that PR review is possible.
2021-02-25 11:27:27 -07:00

51 lines
2.1 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AbstractCommandsQuickAccessProvider, ICommandQuickPick, ICommandsQuickAccessOptions } from 'vs/platform/quickinput/browser/commandsQuickAccess';
import { IEditor } from 'vs/editor/common/editorCommon';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { stripIcons } from 'vs/base/common/iconLabels';
export abstract class AbstractEditorCommandsQuickAccessProvider extends AbstractCommandsQuickAccessProvider {
constructor(
options: ICommandsQuickAccessOptions,
instantiationService: IInstantiationService,
keybindingService: IKeybindingService,
commandService: ICommandService,
telemetryService: ITelemetryService,
notificationService: INotificationService
) {
super(options, instantiationService, keybindingService, commandService, telemetryService, notificationService);
}
/**
* Subclasses to provide the current active editor control.
*/
protected abstract activeTextEditorControl: IEditor | undefined;
protected getCodeEditorCommandPicks(): ICommandQuickPick[] {
const activeTextEditorControl = this.activeTextEditorControl;
if (!activeTextEditorControl) {
return [];
}
const editorCommandPicks: ICommandQuickPick[] = [];
for (const editorAction of activeTextEditorControl.getSupportedActions()) {
editorCommandPicks.push({
commandId: editorAction.id,
commandAlias: editorAction.alias,
label: stripIcons(editorAction.label) || editorAction.id,
});
}
return editorCommandPicks;
}
}