Interface IActionDescriptor

Description of an action contribution

interface IActionDescriptor {
    contextMenuGroupId?: string;
    contextMenuOrder?: number;
    id: string;
    keybindingContext?: string;
    keybindings?: number[];
    label: string;
    precondition?: string;
    run(editor, ...args): void | Promise<void>;
}

Properties

contextMenuGroupId?: string

Control if the action should show up in the context menu and where. The context menu of the editor has these default: navigation - The navigation group comes first in all cases. 1_modification - This group comes next and contains commands that modify your code. 9_cutcopypaste - The last default group with the basic editing commands. You can also create your own group. Defaults to null (don't show in context menu).

contextMenuOrder?: number

Control the order in the context menu group.

id: string

An unique identifier of the contributed action.

keybindingContext?: string

The keybinding rule (condition on top of precondition).

keybindings?: number[]

An array of keybindings for the action.

label: string

A label of the action that will be presented to the user.

precondition?: string

Precondition rule. The value should be a context key expression.

Methods

  • Method that will be executed when the action is triggered.

    Parameters

    • editor: ICodeEditor

      The editor instance is passed in as a convenience

    • Rest ...args: any[]

    Returns void | Promise<void>