registerTextEditorCommand

fun registerTextEditorCommand(command: String, callback: (textEditor: TextEditor, edit: TextEditorEdit) -> Unit, thisArg: JsAny = definedExternally): Disposable(source)

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 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-builder. Note that the edit-builder is only valid while the callback executes.

Parameters

command

A unique identifier for the command.

callback

A command handler function with access to an editor} and an {@link TextEditorEdit edit.

thisArg

The this context used when invoking the handler function.