Class KeybindingRegistry

Constructors

Properties

commandRegistry: CommandRegistry
contexts: {
    [id: string]: KeybindingContext;
} = {}

Type declaration

corePreferences: CorePreferences
keySequence: KeySequence = []
keybindingsChanged: Emitter<void> = ...
keyboardLayoutService: KeyboardLayoutService
keymaps: ScopedKeybinding[][] = ...
logger: ILogger
statusBar: StatusBar
toResetKeymap: Map<KeybindingScope, Disposable> = ...
whenContextService: ContextKeyService
PASSTHROUGH_PSEUDO_COMMAND: "passthrough" = 'passthrough'

Accessors

Methods

  • Parameters

    • key: Key
    • asciiOnly: boolean = false

      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.

    Returns string

  • Get a user visible representation of a key code (a key with modifiers).

    Parameters

    • keyCode: KeyCode

      the keycode

    • separator: string = ' '

      the separator used to separate keys (key and modifiers) in the returning string

    • asciiOnly: boolean = false

      if true, no special characters will be substituted into the string returned. Ensures correct keyboard shortcuts in Electron menus.

    Returns string

    a string representing the KeyCode

  • Parameters

    • input: string | KeyCode | KeyboardEventInit

    Returns KeyboardEventInit & Partial<{
        keyCode: number;
    }>

  • 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.

    Returns void

  • 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.

    Parameters

    • commandId: string

      commandId to test

    Returns boolean

  • 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.

    Parameters

    Returns core.Match

  • Registers the keybinding context arguments into the application. Fails when an already registered context is being registered.

    Parameters

    • Rest ...contexts: KeybindingContext[]

      the keybinding contexts to register into the application.

    Returns void