( bindings: ParsedBinding[], )
| 371 | * Check for reserved shortcuts that may not work. |
| 372 | */ |
| 373 | export function checkReservedShortcuts( |
| 374 | bindings: ParsedBinding[], |
| 375 | ): KeybindingWarning[] { |
| 376 | const warnings: KeybindingWarning[] = [] |
| 377 | const reserved = getReservedShortcuts() |
| 378 | |
| 379 | for (const binding of bindings) { |
| 380 | const keyDisplay = chordToString(binding.chord) |
| 381 | const normalizedKey = normalizeKeyForComparison(keyDisplay) |
| 382 | |
| 383 | // Check against reserved shortcuts |
| 384 | for (const res of reserved) { |
| 385 | if (normalizeKeyForComparison(res.key) === normalizedKey) { |
| 386 | warnings.push({ |
| 387 | type: 'reserved', |
| 388 | severity: res.severity, |
| 389 | message: `"${keyDisplay}" may not work: ${res.reason}`, |
| 390 | key: keyDisplay, |
| 391 | context: binding.context, |
| 392 | action: binding.action ?? undefined, |
| 393 | }) |
| 394 | } |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | return warnings |
| 399 | } |
| 400 | |
| 401 | /** |
| 402 | * Parse user blocks into bindings for validation. |
no test coverage detected