* Build a markdown table of all actions with their default bindings and context.
()
| 31 | * Build a markdown table of all actions with their default bindings and context. |
| 32 | */ |
| 33 | function generateActionsTable(): string { |
| 34 | // Build a lookup: action -> { keys, context } |
| 35 | const actionInfo: Record<string, { keys: string[]; context: string }> = {} |
| 36 | for (const block of DEFAULT_BINDINGS) { |
| 37 | for (const [key, action] of Object.entries(block.bindings)) { |
| 38 | if (action) { |
| 39 | if (!actionInfo[action]) { |
| 40 | actionInfo[action] = { keys: [], context: block.context } |
| 41 | } |
| 42 | actionInfo[action].keys.push(key) |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | return markdownTable( |
| 48 | ['Action', 'Default Key(s)', 'Context'], |
| 49 | KEYBINDING_ACTIONS.map(action => { |
| 50 | const info = actionInfo[action] |
| 51 | const keys = info ? info.keys.map(k => `\`${k}\``).join(', ') : '(none)' |
| 52 | const context = info ? info.context : inferContextFromAction(action) |
| 53 | return [`\`${action}\``, keys, context] |
| 54 | }), |
| 55 | ) |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Infer context from action prefix when not in DEFAULT_BINDINGS. |
no test coverage detected