commands.commandList
Registered commands.
API signature
commands.commandList: CommandItem[]- Returns
- CommandItem[]
- Declaration
- typings/index.d.ts:7982
All 5 public APIs exported from the commands module, with declarations, documentation, and source-backed examples.
Generated from typings/index.d.ts @ 555f5ceon
Registered commands.
commands.commandList: CommandItem[]commands.execute(command: { name: string, arguments?: any[] }): void| Parameter | Type |
|---|---|
| command | { name: string, arguments?: any[] } |
Check if command is registered.
commands.has(id: string): boolean| Parameter | Type | Description |
|---|---|---|
| id | string | Unique id of command. |
Registers a command callable via :CocCommand <id> or programmatically.
commands.registerCommand(id: string, impl: (...args: any[]) => void, thisArg?: any, internal?: boolean): Disposableimport { commands, window, ExtensionContext } from 'coc.nvim';
export function activate(context: ExtensionContext) {
context.subscriptions.push(
commands.registerCommand('myextension.sayHello', async () => {
window.showInformationMessage('Hello from coc.nvim extension!');
})
);
}| Parameter | Type | Description |
|---|---|---|
| id | string | A unique identifier for the command. |
| impl | (...args: any[]) => void | A command handler function. |
| thisArg? | any | The |
| internal? | boolean |
Disposable which unregisters this command on disposal.
Executes the command denoted by the given command identifier.
string, boolean,
number, undefined, and null, as well as Position, Range, URI and Location.commands.executeCommand<T>(command: string, ...rest: any[]): Promise<T>Identifier of the command to execute.
Parameters passed to the command function.
commands.executeCommand(command: 'vscode.open', uri: string | Uri): Promise<void>commands.executeCommand(command: 'workbench.action.reloadWindow'): Promise<void>commands.executeCommand(command: 'workbench.action.openSettingsJson'): Promise<void>commands.executeCommand(command: 'editor.action.insertSnippet', edit: TextEdit, ultisnip?: UltiSnippetOption): Promise<boolean>Contains snippet text and range to replace.
commands.executeCommand(command: 'editor.action.doCodeAction', action: CodeAction): Promise<void>commands.executeCommand(command: 'editor.action.triggerSuggest', source?: string): Promise<void>commands.executeCommand(command: 'editor.action.triggerParameterHints'): Promise<void>commands.executeCommand(command: 'editor.action.addRanges', ranges: Range[]): Promise<void>commands.executeCommand(command: 'editor.action.restart'): Promise<void>commands.executeCommand(command: 'editor.action.showReferences', uri: string | Uri, position: Position | undefined, locations: Location[]): Promise<void>commands.executeCommand(command: 'editor.action.rename', uri: string | Uri, position: Position, newName?: string): Promise<void>commands.executeCommand(command: 'editor.action.format'): Promise<void>commands.executeCommand(command: 'editor.action.triggerInlineCompletion', option?: InlineCompletionOption): Promise<void>commands.executeCommand(command: 'editor.action.triggerNextEdit', option?: { provider?: string; autoTrigger?: boolean }): Promise<boolean>commands.executeCommand<T>(command: string, ...rest: any[]): Promise<T>| Parameter | Type | Description |
|---|---|---|
| command | string | Identifier of the command to execute. |
| ...rest? | any[] | Parameters passed to the command function. |
A promise that resolves to the returned value of the given command. undefined when
the command handler function doesn't return anything.