sussudio
Version:
An unofficial VS Code Internal API
59 lines (58 loc) • 3.48 kB
text/typescript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CancellationToken } from "../../../base/common/cancellation.mjs";
import { Disposable, DisposableStore, IDisposable } from "../../../base/common/lifecycle.mjs";
import { ICommandService } from "../../commands/common/commands.mjs";
import { IConfigurationService } from "../../configuration/common/configuration.mjs";
import { IDialogService } from "../../dialogs/common/dialogs.mjs";
import { IInstantiationService } from "../../instantiation/common/instantiation.mjs";
import { IKeybindingService } from "../../keybinding/common/keybinding.mjs";
import { IPickerQuickAccessItem, IPickerQuickAccessProviderOptions, PickerQuickAccessProvider } from "./pickerQuickAccess.mjs";
import { IQuickPickSeparator } from "../common/quickInput.mjs";
import { IStorageService } from "../../storage/common/storage.mjs";
import { ITelemetryService } from "../../telemetry/common/telemetry.mjs";
export interface ICommandQuickPick extends IPickerQuickAccessItem {
commandId: string;
commandAlias?: string;
}
export interface ICommandsQuickAccessOptions extends IPickerQuickAccessProviderOptions<ICommandQuickPick> {
showAlias: boolean;
}
export declare abstract class AbstractCommandsQuickAccessProvider extends PickerQuickAccessProvider<ICommandQuickPick> implements IDisposable {
private readonly instantiationService;
private readonly keybindingService;
private readonly commandService;
private readonly telemetryService;
private readonly dialogService;
static PREFIX: string;
private static WORD_FILTER;
private readonly commandsHistory;
protected readonly options: ICommandsQuickAccessOptions;
constructor(options: ICommandsQuickAccessOptions, instantiationService: IInstantiationService, keybindingService: IKeybindingService, commandService: ICommandService, telemetryService: ITelemetryService, dialogService: IDialogService);
protected _getPicks(filter: string, _disposables: DisposableStore, token: CancellationToken): Promise<Array<ICommandQuickPick | IQuickPickSeparator>>;
/**
* Subclasses to provide the actual command entries.
*/
protected abstract getCommandPicks(token: CancellationToken): Promise<Array<ICommandQuickPick>>;
}
export declare class CommandsHistory extends Disposable {
private readonly storageService;
private readonly configurationService;
static readonly DEFAULT_COMMANDS_HISTORY_LENGTH = 50;
private static readonly PREF_KEY_CACHE;
private static readonly PREF_KEY_COUNTER;
private static cache;
private static counter;
private configuredCommandsHistoryLength;
constructor(storageService: IStorageService, configurationService: IConfigurationService);
private registerListeners;
private updateConfiguration;
private load;
push(commandId: string): void;
peek(commandId: string): number | undefined;
static saveState(storageService: IStorageService): void;
static getConfiguredCommandHistoryLength(configurationService: IConfigurationService): number;
static clearHistory(configurationService: IConfigurationService, storageService: IStorageService): void;
}