import { Event } from '../../../base/common/event'; import { IJSONSchema } from '../../../base/common/jsonSchema'; import { IDisposable } from '../../../base/common/lifecycle'; import { TypeConstraint } from '../../../base/common/types'; import { ILocalizedString } from '../../../platform/action/common/action'; import { ServicesAccessor } from '../../../platform/instantiation/common/instantiation'; export declare const ICommandService: import("../../../platform/instantiation/common/instantiation").ServiceIdentifier; export interface ICommandEvent { commandId: string; args: any[]; } export interface ICommandService { readonly _serviceBrand: undefined; onWillExecuteCommand: Event; onDidExecuteCommand: Event; executeCommand(commandId: string, ...args: any[]): Promise; } export type ICommandsMap = Map; export interface ICommandHandler { (accessor: ServicesAccessor, ...args: any[]): void; } export interface ICommand { id: string; handler: ICommandHandler; metadata?: ICommandMetadata | null; } export interface ICommandMetadata { /** * NOTE: Please use an ILocalizedString. string is in the type for backcompat for now. * A short summary of what the command does. This will be used in: * - API commands * - when showing keybindings that have no other UX * - when searching for commands in the Command Palette */ readonly description: ILocalizedString | string; readonly args?: ReadonlyArray<{ readonly name: string; readonly isOptional?: boolean; readonly description?: string; readonly constraint?: TypeConstraint; readonly schema?: IJSONSchema; }>; readonly returns?: string; } export interface ICommandRegistry { onDidRegisterCommand: Event; registerCommand(id: string, command: ICommandHandler): IDisposable; registerCommand(command: ICommand): IDisposable; registerCommandAlias(oldId: string, newId: string): IDisposable; getCommand(id: string): ICommand | undefined; getCommands(): ICommandsMap; } export declare const CommandsRegistry: ICommandRegistry;