Skip to main content

Module KeybindingProvider

Module KeybindingProvider 

Source
Expand description

KeybindingProvider: resolves keybinding contributions and chord sequences.

§KeybindingProvider (Environment)

Implements the KeybindingProvider trait for MountainEnvironment, providing keybinding resolution, conflict detection, and command activation based on keyboard input.

Keybindings are collected from three sources in descending priority: user keybindings.json overrides, extension contributes.keybindings, and Mountain built-ins. Negative commands (prefixed with -) act as unbind rules and remove the matching entry.

§When clause evaluation

“When” clauses are boolean expressions over context keys that control whether a keybinding is active. Examples:

  • "editorTextFocus && !inQuickOpen" - only when editor has focus
  • "debugState != 'inactive'" - only when debugging
  • "resourceLangId == python" - only for Python files

Current implementation stores when clauses but only partially evaluates them. Full expression parsing and evaluation is pending.

§VS Code reference

  • vs/platform/keybinding/common/keybinding.ts
  • vs/platform/keybinding/common/keybindingResolver.ts
  • vs/platform/keybinding/common/keybindingsRegistry.ts
  • vs/platform/contextkey/common/contextkey.ts

Structs§

KeybindingRule 🔒