import { IDisposable, IExtensionInfo } from '@opensumi/ide-core-common'; import { Disposable } from './ext-types'; export interface IMainThreadCommands { $registerCommand(id: string): void; $unregisterCommand(id: string): void; $getCommands(): Promise; /** * 来自main -> extHost的command调用 */ $executeExtensionCommand(id: string, ...args: any[]): Promise; /** * 来自ext -> main的command调用 */ $executeCommand(id: string, ...args: any[]): Promise; $executeCommandWithExtensionInfo(id: string, extensionInfo: IExtensionInfo, ...args: any[]): Promise; registerArgumentProcessor(processor: ArgumentProcessor): IDisposable; } export interface CommandHandler { handler: Handler; thisArg?: any; description?: ICommandHandlerDescription; isPermitted?: PermittedHandler; } export type Handler = (...args: any[]) => T | Promise; export type PermittedHandler = (extensionInfo: IExtensionInfo, ...args: any[]) => boolean; export interface ArgumentProcessor { processArgument(arg: any): any; } export interface IExtHostCommands { registerCommand(global: boolean, id: string, handler: Handler, thisArg?: any, description?: ICommandHandlerDescription): Disposable; registerCommand(global: boolean, id: string, handler: CommandHandler): Disposable; executeCommand(id: string, ...args: any[]): Promise; getCommands(filterUnderscoreCommands: boolean): Promise; registerArgumentProcessor(processor: ArgumentProcessor): void; $executeContributedCommand(id: string, ...args: any[]): Promise; $executeCommandWithExtensionInfo(id: string, extensionInfo: IExtensionInfo, ...args: any[]): Promise; $registerBuiltInCommands(): void; $registerCommandConverter(): void; } export interface ICommandHandlerDescription { description: string; args: { name: string; description?: string; constraint?: any; schema?: any; }[]; returns?: string; } //# sourceMappingURL=command.d.ts.map