declare module 'vscode' { /** * Represents a reference to a command. Provides a title which * will be used to represent a command in the UI and, optionally, * an array of arguments which will be passed to the command handler * function when invoked. */ export interface Command { /** * Title of the command, like `save`. */ title: string; /** * The identifier of the actual command handler. * @see [commands.registerCommand](#commands.registerCommand). */ command: string; /** * A tooltip for the command, when represented in the UI. */ tooltip?: string; /** * Arguments that the command handler should be * invoked with. */ arguments?: any[]; } export namespace commands { /** * Registers a command that can be invoked via a keyboard shortcut, * a menu item, an action, or directly. * * Registering a command with an existing command identifier twice * will cause an error. * * @param command A unique identifier for the command. * @param callback A command handler function. * @param thisArg The `this` context used when invoking the handler function. * @return Disposable which unregisters this command on disposal. */ export function registerCommand(command: string, callback: (...args: any[]) => any, thisArg?: any): Disposable; /** * Executes the command denoted by the given command identifier. * * * *Note 1:* When executing an editor command not all types are allowed to * be passed as arguments. Allowed are the primitive types `string`, `boolean`, * `number`, `undefined`, and `null`, as well as [`Position`](#Position), [`Range`](#Range), [`Uri`](#Uri) and [`Location`](#Location). * * *Note 2:* There are no restrictions when executing commands that have been contributed * by extensions. * * @param command Identifier of the command to execute. * @param rest Parameters passed to the command function. * @return A thenable that resolves to the returned value of the given command. `undefined` when * the command handler function doesn't return anything. */ export function executeCommand(command: string, ...rest: any[]): Thenable; /** * Retrieve the list of all available commands. Commands starting an underscore are * treated as internal commands. * * @param filterInternal Set `true` to not see internal commands (starting with an underscore) * @return Thenable that resolves to a list of command ids. */ export function getCommands(filterInternal?: boolean): Thenable; /** * Registers a text editor command that can be invoked via a keyboard shortcut, * a menu item, an action, or directly. * * Text editor commands are different from ordinary [commands](#commands.registerCommand) as * they only execute when there is an active editor when the command is called. Also, the * command handler of an editor command has access to the active editor and to an * [edit](#TextEditorEdit)-builder. * * @param command A unique identifier for the command. * @param callback A command handler function with access to an [editor](#TextEditor) and an [edit](#TextEditorEdit). * @param thisArg The `this` context used when invoking the handler function. * @return Disposable which unregisters this command on disposal. */ export function registerTextEditorCommand(command: string, callback: (textEditor: TextEditor, edit: TextEditorEdit, ...args: any[]) => void, thisArg?: any): Disposable; } }