(userBlocks: unknown)
| 310 | * Validate user keybinding config and return all warnings. |
| 311 | */ |
| 312 | export function validateUserConfig(userBlocks: unknown): KeybindingWarning[] { |
| 313 | const warnings: KeybindingWarning[] = [] |
| 314 | |
| 315 | if (!Array.isArray(userBlocks)) { |
| 316 | warnings.push({ |
| 317 | type: 'parse_error', |
| 318 | severity: 'error', |
| 319 | message: 'keybindings.json must contain an array', |
| 320 | suggestion: 'Wrap your bindings in [ ]', |
| 321 | }) |
| 322 | return warnings |
| 323 | } |
| 324 | |
| 325 | for (let i = 0; i < userBlocks.length; i++) { |
| 326 | warnings.push(...validateBlock(userBlocks[i], i)) |
| 327 | } |
| 328 | |
| 329 | return warnings |
| 330 | } |
| 331 | |
| 332 | /** |
| 333 | * Check for duplicate bindings within the same context. |
no test coverage detected