Private _commandPrivate _commandPrivate _commandsPrivate _exactPrivate _keyPrivate _keyPrivate _keydownPrivate _keystrokesPrivate _replayingPrivate _timerIDA signal emitted when a command has changed.
This signal is useful for visual representations of commands which need to refresh when the state of a relevant command has changed.
A signal emitted when a command has executed.
Care should be taken when consuming this signal. The command system is used by many components for many user actions. Handlers registered with this signal must return quickly to ensure the overall application remains responsive.
A signal emitted when a key binding is changed.
A read-only array of the key bindings in the registry.
Private _clearPrivate _clearPrivate _executeExecute the command for the given key binding.
If the command is missing or disabled, a warning will be logged.
Private _onPrivate _replayPrivate _startAdd a command to the registry.
A disposable which will remove the command.
An error if the given id is already registered.
The unique id of the command.
The options for the command.
Add a key binding to the registry.
A disposable which removes the added key binding.
If multiple key bindings are registered for the same sequence, the binding with the highest selector specificity is executed first. A tie is broken by using the most recently added key binding.
Ambiguous key bindings are resolved with a timeout. As an example,
suppose two key bindings are registered: one with the key sequence
['Ctrl D'], and another with ['Ctrl D', 'Ctrl W']. If the user
presses Ctrl D, the first binding cannot be immediately executed
since the user may intend to complete the chord with Ctrl W. For
such cases, a timer is used to allow the chord to be completed. If
the chord is not completed before the timeout, the first binding
is executed.
The options for creating the key binding.
Get the short form caption for a specific command.
The caption for the command, or an empty string if the command is not registered.
The id of the command of interest.
The arguments for the command.
Get the extra class name for a specific command.
The class name for the command, or an empty string if the command is not registered.
The id of the command of interest.
The arguments for the command.
Get the dataset for a specific command.
The dataset for the command, or an empty dataset if the command is not registered.
The id of the command of interest.
The arguments for the command.
Get the description for a specific command.
The description for the command.
The id of the command of interest.
The arguments for the command.
Execute a specific command.
A promise which resolves with the result of the command.
The promise will reject if the command throws an exception, or if the command is not registered.
The id of the command of interest.
The arguments for the command.
Get the icon renderer for a specific command.
DEPRECATED: if set to a string value, the .icon field will function as an alias for the .iconClass field, for backwards compatibility. In the future when this is removed, the default return type will become undefined.
The icon renderer for the command or undefined.
The id of the command of interest.
The arguments for the command.
Get the icon class for a specific command.
The icon class for the command, or an empty string if the command is not registered.
The id of the command of interest.
The arguments for the command.
Get the icon label for a specific command.
The icon label for the command, or an empty string if the command is not registered.
The id of the command of interest.
The arguments for the command.
Test whether a specific command is enabled.
A boolean indicating whether the command is enabled,
or false if the command is not registered.
The id of the command of interest.
The arguments for the command.
Test whether a specific command is toggleable.
A boolean indicating whether the command is toggleable,
or false if the command is not registered.
The id of the command of interest.
The arguments for the command.
Test whether a specific command is toggled.
A boolean indicating whether the command is toggled,
or false if the command is not registered.
The id of the command of interest.
The arguments for the command.
Test whether a specific command is visible.
A boolean indicating whether the command is visible,
or false if the command is not registered.
The id of the command of interest.
The arguments for the command.
Get the display label for a specific command.
The display label for the command, or an empty string if the command is not registered.
The id of the command of interest.
The arguments for the command.
Get the mnemonic index for a specific command.
The mnemonic index for the command, or -1 if the
command is not registered.
The id of the command of interest.
The arguments for the command.
Notify listeners that the state of a command has changed.
An error if the given id is not registered.
This method should be called by the command author whenever the application state changes such that the results of the command metadata functions may have changed.
This will cause the commandChanged signal to be emitted.
Optional id: stringThe id of the command which has changed. If more than one command has changed, this argument should be omitted.
Process a 'keydown' event and invoke a matching key binding.
The event object for a 'keydown' event.
This should be called in response to a 'keydown' event in order
to invoke the command for the best matching key binding.
The registry does not install its own listener for 'keydown'
events. This allows the application full control over the nodes
and phase for which the registry processes 'keydown' events.
When the keydown event is processed, if the event target or any of its
ancestor nodes has a data-lm-suppress-shortcuts attribute, its keydown
events will not invoke commands.
Get the usage help text for a specific command.
The usage text for the command, or an empty string if the command is not registered.
The id of the command of interest.
The arguments for the command.
Generated using TypeDoc
An object which manages a collection of commands.
Notes
A command registry can be used to populate a variety of action-based widgets, such as command palettes, menus, and toolbars.