( userBlocks: unknown, _parsedBindings: ParsedBinding[], )
| 423 | * Run all validations and return combined warnings. |
| 424 | */ |
| 425 | export function validateBindings( |
| 426 | userBlocks: unknown, |
| 427 | _parsedBindings: ParsedBinding[], |
| 428 | ): KeybindingWarning[] { |
| 429 | const warnings: KeybindingWarning[] = [] |
| 430 | |
| 431 | // Validate user config structure |
| 432 | warnings.push(...validateUserConfig(userBlocks)) |
| 433 | |
| 434 | // Check for duplicates in user config |
| 435 | if (isKeybindingBlockArray(userBlocks)) { |
| 436 | warnings.push(...checkDuplicates(userBlocks)) |
| 437 | |
| 438 | // Check for reserved/conflicting shortcuts - only check USER bindings |
| 439 | const userBindings = getUserBindingsForValidation(userBlocks) |
| 440 | warnings.push(...checkReservedShortcuts(userBindings)) |
| 441 | } |
| 442 | |
| 443 | // Deduplicate warnings (same key+context+type) |
| 444 | const seen = new Set<string>() |
| 445 | return warnings.filter(w => { |
| 446 | const key = `${w.type}:${w.key}:${w.context}` |
| 447 | if (seen.has(key)) return false |
| 448 | seen.add(key) |
| 449 | return true |
| 450 | }) |
| 451 | } |
| 452 | |
| 453 | /** |
| 454 | * Format a warning for display to the user. |
no test coverage detected