( input: string, key: Key, activeContexts: KeybindingContextName[], bindings: ParsedBinding[], )
| 32 | * @returns The resolution result |
| 33 | */ |
| 34 | export function resolveKey( |
| 35 | input: string, |
| 36 | key: Key, |
| 37 | activeContexts: KeybindingContextName[], |
| 38 | bindings: ParsedBinding[], |
| 39 | ): ResolveResult { |
| 40 | // Find matching bindings (last one wins for user overrides) |
| 41 | let match: ParsedBinding | undefined |
| 42 | const ctxSet = new Set(activeContexts) |
| 43 | |
| 44 | for (const binding of bindings) { |
| 45 | // Phase 1: Only single-keystroke bindings |
| 46 | if (binding.chord.length !== 1) continue |
| 47 | if (!ctxSet.has(binding.context)) continue |
| 48 | |
| 49 | if (matchesBinding(input, key, binding)) { |
| 50 | match = binding |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | if (!match) { |
| 55 | return { type: 'none' } |
| 56 | } |
| 57 | |
| 58 | if (match.action === null) { |
| 59 | return { type: 'unbound' } |
| 60 | } |
| 61 | |
| 62 | return { type: 'match', action: match.action } |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Get display text for an action from bindings (e.g., "ctrl+t" for "app:toggleTodos"). |
nothing calls this directly
no test coverage detected