Protected ReadonlycommandProtected ReadonlycontextProtected ReadonlycontextsProtected ReadonlycontributionsProtected ReadonlycoreProtected ReadonlyhandledProtectedkeybindingsProtectedkeybindingProtected ReadonlykeyboardProtectedkeyboardWhether keyboard shortcut troubleshooting logs are enabled.
Protected ReadonlykeymapsProtectedkeyProtected ReadonlyloggerProtected ReadonlystatusProtected ReadonlytoProtected ReadonlywarnedProtected ReadonlywhenStatic ReadonlyPASSTHROUGH_Event that is fired when the resolved keybindings change due to a different keyboard layout or when a new keymap is being set
Get a user visible representation of a common.Keybinding.
the keybinding
the separator to be used to stringify KeyCodes that are part of the KeySequence
whether to render logical characters or their physical realization
an array of strings representing all elements of the KeySequence defined by the common.Keybinding
ProtectedacceleratorGet the accelerator of the first keybinding of a command that is enabled in the given context. If no such keybinding exists and the command is enabled, the first enabled keybinding that is only displayed for the command is used, see common.Keybinding#displayFor. Physical accelerators (for native menus) are omitted for inactive keybindings.
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.
Ignored when rendering macOS symbols (i.e. on macOS with asciiOnly=false), as the convention is
to juxtapose modifier symbols without a separator (e.g. ⌃⌘V).
if true, no special characters will be substituted into the string returned. Ensures correct keyboard shortcuts in Electron menus.
whether to render the logical character or its physical realization
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
whether to render logical characters or their physical realization
an array of strings representing all elements of the KeySequence
ProtectedasReturn the keybinding stroke the keybinding recorder persists for normalized keyboard input, or undefined for modifier-only input.
Return the authored representation that should be persisted for normalized keyboard input.
ProtectedbuildBuilds a ternary search tree from all registered keybindings for efficient lookup. Bindings are indexed by their resolved key sequence. Bindings are stored in the order they should be checked: highest scope first, and within the same scope, in the order they appear in keymaps (later-registered first).
ProtectedclearClear all resolved properties of registered keybindings so the keyboard layout service resolves them again.
ProtectedcollectCollect the keybindings of all scopes, highest scope first, that match the given predicate
and have not been disabled by a -command keybinding of the same or a higher scope.
Checks whether a colliding common.Keybinding exists in a specific scope.
the keybinding to check
the keybinding scope to check
true if there is a colliding keybinding
Executes the command by dispatching its first keybinding: the resolved key codes are matched directly, and a DOM keydown marked as already handled is dispatched to the target for other listeners to observe.
Optionaltarget: EventTargetDispatch a DOM keydown, optionally marking it as already handled by direct normalized dispatch.
Runs normalized keyboard data directly through keybinding matching without dispatching a DOM event.
Optionaltarget: EventTargetOptionalkeyCodes: KeyCode[]Whether the logical label of a key code shows Shift: when Shift is a command modifier or produces an uppercase letter.
Shift that only selects a layout layer for other characters (e.g. / on German layouts) is not shown.
ProtecteddoProtecteddoProtectedexecuteTries to execute a keybinding.
to execute
keyboard event.
ProtectedgetGet the keybindings that don't execute a command but are shown as its accelerator. See common.Keybinding#displayFor.
The ID of the command for which we are looking for keybindings.
an array of ScopedKeybinding
ProtectedgetReturn authored, layout-resolved, and shadowing collision diagnostics for a binding.
Return the localized explanation when a binding is inactive on the current layout.
Get all common.Keybindings for a KeybindingScope.
the keybinding scope to retrieve the common.Keybindings for.
an array of 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
ProtectedgetGets or builds the keybinding tree for efficient lookup. The tree maps resolved key sequences to arrays of bindings sorted by scope (highest first).
Return all runtime interpretations of normalized keyboard input.
ProtectedgetFinds collisions for a key sequence inside a list of bindings (error-free)
the reference bindings
the sequence to match
Return bindings whose command-modifier interpretation takes the keystroke instead of the supplied binding.
Optionalscope: KeybindingScopeProtectedgetReturn a new filtered array containing only the usable bindings among the input bindings
Bindings to filter
ProtectedinsertEnsures 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)
ProtectedinvalidateInvalidates the keybinding tree, causing it to be rebuilt on next access.
ProtectedinvalidateClear cached resolutions, invalidate the lookup tree, and notify listeners.
ProtectedisProtectedisOnly execute if it has no context (global context) or if we're in that context.
Return whether a binding is inactive on the current keyboard layout.
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
ProtectedisReturns true if the binding is usable
Binding to be checked
ProtectedlogOptionalkeyCode: KeyCodeOptionalmatch: KeybindingRegistry.MatchOptionalskipped: stringMatch first binding in the current context. Keybindings ordered by a scope and by a registration order within the scope.
Uses a ternary search tree for efficient O(log n) lookup instead of O(n) iteration. The tree is lazily built and invalidated when keybindings change.
keySequence must be a resolved sequence from resolveKeybinding or a runtime interpretation from
getKeyCodeInterpretations. Lookup uses KeyCode.dispatchString identity, so raw
KeySequence.parse output only matches when parsing and resolution coincide, such as keyboard.dispatch: 'keyCode'.
When multiple bindings match, bindings that use context keys local to the focused element are given priority over bindings that only use global context keys.
Optionalevent: KeyboardEventProtectedmatchHigher values win; explicit command modifiers take precedence over layout-modifier interpretations.
ProtectedregisterRegisters 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.
ProtectedrunOptionalkeyCodesOverride: KeyCode[]ProtectedselectSelects the most appropriate binding from a list of enabled bindings.
Prioritizes bindings whose when clause uses context keys that are locally
defined at the focused element, as these are more specific to the user's
current focus context.
Array of enabled bindings to choose from (must not be empty)
Optionalevent: KeyboardEvent
Optional keyboard event to get the focused element from
The selected binding
Sets a new keymap replacing all existing common.Keybindings in the given scope.
the keybinding scope
an array containing the new common.Keybindings
Mirrors VS Code's workbench.action.toggleKeybindingsLog command.
It logs how each key press was interpreted so keyboard-layout problems can be diagnosed on other machines.
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
Ternary search tree for efficient keybinding lookup. Maps resolved key sequences to arrays of bindings sorted by scope (highest first).