Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CommandRegistry

The command registry manages commands and handlers.

Hierarchy

  • CommandRegistry

Implements

Index

Constructors

constructor

Properties

Protected Readonly _commands

_commands: {} = {}

Type declaration

Protected Readonly _handlers

_handlers: {} = {}

Type declaration

Protected _recent

_recent: Command[] = []

Protected Readonly contributionProvider

Readonly onDidExecuteCommand

onDidExecuteCommand: Event<CommandEvent> = ...

Protected Readonly onDidExecuteCommandEmitter

onDidExecuteCommandEmitter: Emitter<CommandEvent> = ...

Readonly onWillExecuteCommand

onWillExecuteCommand: Event<WillExecuteCommandEvent> = ...

Protected Readonly onWillExecuteCommandEmitter

onWillExecuteCommandEmitter: Emitter<WillExecuteCommandEvent> = ...

Protected Readonly toUnregisterCommands

toUnregisterCommands: Map<string, Disposable> = ...

Accessors

commandIds

  • get commandIds(): string[]

commands

recent

Methods

addRecentCommand

clearCommandHistory

  • clearCommandHistory(): void

Protected doRegisterCommand

executeCommand

  • executeCommand<T>(commandId: string, ...args: any[]): Promise<undefined | T>
  • 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>

Protected fireWillExecuteCommand

  • fireWillExecuteCommand(commandId: string, args?: any[]): Promise<void>

getActiveHandler

  • getActiveHandler(commandId: string, ...args: any[]): undefined | CommandHandler

getAllHandlers

getCommand

  • getCommand(id: string): undefined | Command

getToggledHandler

  • getToggledHandler(commandId: string, ...args: any[]): undefined | CommandHandler

getVisibleHandler

  • getVisibleHandler(commandId: string, ...args: any[]): undefined | CommandHandler

isEnabled

  • isEnabled(command: string, ...args: any[]): boolean

isToggled

  • isToggled(command: string, ...args: any[]): boolean

isVisible

  • isVisible(command: string, ...args: any[]): boolean

onStart

  • onStart(): void

registerCommand

registerHandler

  • 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

unregisterCommand

  • unregisterCommand(command: Command): void
  • unregisterCommand(id: string): void