The command registry manages commands and handlers.

Implements

Constructors

Properties

_commands: {
    [id: string]: Command;
} = {}

Type declaration

_handlers: {
    [id: string]: CommandHandler[];
} = {}

Type declaration

_recent: string[] = []
fireDidChange: ((...arguments) => Promise<void>) = ...

Type declaration

    • (...arguments): Promise<void>
    • Parameters

      • Rest ...arguments: []

      Returns Promise<void>

onCommandsChanged: Event<void> = ...
onCommandsChangedEmitter: Emitter<void> = ...
onDidExecuteCommand: Event<CommandEvent> = ...

An event is emitted when a command was executed.

onDidExecuteCommandEmitter: Emitter<CommandEvent> = ...
onWillExecuteCommand: Event<WillExecuteCommandEvent> = ...

An event is emitted when a command is about to be executed.

It can be used to install or activate a command handler.

onWillExecuteCommandEmitter: Emitter<WillExecuteCommandEvent> = ...
toUnregisterCommands: Map<string, Disposable> = ...

Accessors

Methods

  • Adds a command to recently used list. Prioritizes commands that were recently executed to be most recent.

    Parameters

    • recent: Command | Command[]

      a recent command, or array of recent commands.

    Returns void

  • Execute the active handler for the given command and arguments.

    Reject if a command cannot be executed.

    Type Parameters

    • T

    Parameters

    • commandId: string
    • Rest ...args: any[]

    Returns Promise<undefined | T>

  • Test whether there is an active handler for the given command.

    Parameters

    • command: string
    • Rest ...args: any[]

    Returns boolean

  • Test whether there is a toggled handler for the given command.

    Parameters

    • command: string
    • Rest ...args: any[]

    Returns boolean

  • Test whether there is a visible handler for the given command.

    Parameters

    • command: string
    • Rest ...args: any[]

    Returns boolean

  • Register the given handler for the given command identifier.

    If there is already a handler for the given command then the given handler is registered as more specific, and has higher priority during enablement, visibility and toggle state evaluations.

    Parameters

    Returns Disposable