Get a user visible representation of a {@link common.Keybinding}.
the keybinding
the separator to be used to stringify KeyCodes that are part of the KeySequence
an array of strings representing all elements of the KeySequence defined by the {@link common.Keybinding}
if true
, no special characters will be substituted into the string returned. Ensures correct keyboard shortcuts in Electron menus.
Return a user visible representation of a single key.
Get a user visible representation of a key code (a key with modifiers).
the keycode
the separator used to separate keys (key and modifiers) in the returning string
if true
, no special characters will be substituted into the string returned. Ensures correct keyboard shortcuts in Electron menus.
a string representing the KeyCode
Get a user visible representation of a KeySequence.
the keysequence
the separator to be used to stringify KeyCodes that are part of the KeySequence
an array of strings representing all elements of the KeySequence
Clear all resolved
properties of registered keybindings so the KeyboardLayoutService is called
again to resolve them. This is necessary when the user's keyboard layout has changed.
Checks whether a colliding {@link common.Keybinding} exists in a specific scope.
the keybinding to check
the keybinding scope to check
true if there is a colliding keybinding
Tries to execute a keybinding.
to execute
keyboard event.
Finds collisions for a key sequence inside a list of bindings (error-free)
the reference bindings
the sequence to match
Get all {@link common.Keybinding}s for a KeybindingScope.
the keybinding scope to retrieve the {@link common.Keybinding}s for.
an array of {@link common.ScopedKeybinding}
Get all keybindings associated to a commandId.
The ID of the command for which we are looking for keybindings.
an array of ScopedKeybinding
Return a new filtered array containing only the usable bindings among the input bindings
Bindings to filter
Ensures that keybindings are inserted in order of increasing length of binding to ensure that if a user triggers a short keybinding (e.g. ctrl+k), the UI won't wait for a longer one (e.g. ctrl+k enter)
Only execute if it has no context (global context) or if we're in that context.
Return true of string a pseudo-command id, in other words a command id that has a special meaning and that we won't find in the command registry.
commandId to test
Returns true if the binding is usable
Binding to be checked
Match first binding in the current context. Keybindings ordered by a scope and by a registration order within the scope.
FIXME: This method should run very fast since it happens on each keystroke. We should reconsider how keybindings are stored. It should be possible to look up full and partial keybinding for given key sequence for constant time using some kind of tree. Such tree should not contain disabled keybindings and be invalidated whenever the registry is changed.
Registers the keybinding context arguments into the application. Fails when an already registered context is being registered.
the keybinding contexts to register into the application.
Register a default keybinding to the registry.
Keybindings registered later have higher priority during evaluation.
the keybinding to be registered
Register multiple default keybindings to the registry
An array of keybinding to be registered
Reset keybindings for all scopes(only leaves the default keybindings mapped)
Reset keybindings for a specific scope
scope to reset the keybindings for
Ensure that the resolved
property of the given binding is set by calling the KeyboardLayoutService.
Run the command matching to the given keyboard event.
Sets a new keymap replacing all existing {@link common.Keybinding}s in the given scope.
the keybinding scope
an array containing the new {@link common.Keybinding}s
Unregister all keybindings from the registry that are bound to the key of the given keybinding
a keybinding specifying the key to be unregistered
Unregister all keybindings with the given key from the registry
a key to be unregistered
Unregister all existing keybindings for the given command
the command to unregister all keybindings for
Event that is fired when the resolved keybindings change due to a different keyboard layout or when a new keymap is being set