mirror of
https://github.com/coder/code-server.git
synced 2026-05-09 05:47:26 +02:00
These conflicts will be resolved in the following commits. We do it this way so that PR review is possible.
51 lines
2.1 KiB
TypeScript
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;
|
|
}
|
|
}
|