* Parse user blocks into bindings for validation. * This is separate from the main parser to avoid importing it.
( userBlocks: KeybindingBlock[], )
| 403 | * This is separate from the main parser to avoid importing it. |
| 404 | */ |
| 405 | function getUserBindingsForValidation( |
| 406 | userBlocks: KeybindingBlock[], |
| 407 | ): ParsedBinding[] { |
| 408 | const bindings: ParsedBinding[] = [] |
| 409 | for (const block of userBlocks) { |
| 410 | for (const [key, action] of Object.entries(block.bindings)) { |
| 411 | const chord = key.split(' ').map(k => parseKeystroke(k)) |
| 412 | bindings.push({ |
| 413 | chord, |
| 414 | action, |
| 415 | context: block.context, |
| 416 | }) |
| 417 | } |
| 418 | } |
| 419 | return bindings |
| 420 | } |
| 421 | |
| 422 | /** |
| 423 | * Run all validations and return combined warnings. |
no test coverage detected