Methods
executeCommand<T>(command:String, rest:Rest<Any>):Thenable<Null<T>>
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
, andnull
, as well as {@linkcode Position}, {@linkcode Range}, {@linkcode Uri} and {@linkcode Location}. - Note 2: There are no restrictions when executing commands that have been contributed by extensions.
Parameters:
command | Identifier of the command to execute. |
---|---|
rest | Parameters passed to the command function. |
Returns:
A thenable that resolves to the returned value of the given command. undefined
when
the command handler function doesn't return anything.
getCommands(?filterInternal:Bool):Thenable<Array<String>>
Retrieve the list of all available commands. Commands starting with an underscore are treated as internal commands.
Parameters:
filterInternal | Set |
---|
Returns:
Thenable that resolves to a list of command ids.
registerCommand(command:String, callback:Function, ?thisArg:Any):Disposable
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.
Parameters:
command | A unique identifier for the command. |
---|---|
callback | A command handler function. |
thisArg | The |
Returns:
Disposable which unregisters this command on disposal.
registerTextEditorCommand(command:String, callback:(TextEditor, TextEditorEdit) ‑> Void, ?thisArg:Any):Disposable
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 {@link commands.registerCommand commands} 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 {@link TextEditorEdit edit}-builder. Note that the edit-builder is only valid while the callback executes.
@link TextEditor editor} and an {@link TextEditorEdit edit}.
Parameters:
command | A unique identifier for the command. |
---|---|
callback | A command handler function with access to an { |
thisArg | The |
Returns:
Disposable which unregisters this command on disposal.