(warnings: KeybindingWarning[])
| 468 | * Format multiple warnings for display. |
| 469 | */ |
| 470 | export function formatWarnings(warnings: KeybindingWarning[]): string { |
| 471 | if (warnings.length === 0) return '' |
| 472 | |
| 473 | const errors = warnings.filter(w => w.severity === 'error') |
| 474 | const warns = warnings.filter(w => w.severity === 'warning') |
| 475 | |
| 476 | const lines: string[] = [] |
| 477 | |
| 478 | if (errors.length > 0) { |
| 479 | lines.push( |
| 480 | `Found ${errors.length} keybinding ${plural(errors.length, 'error')}:`, |
| 481 | ) |
| 482 | for (const e of errors) { |
| 483 | lines.push(formatWarning(e)) |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | if (warns.length > 0) { |
| 488 | if (lines.length > 0) lines.push('') |
| 489 | lines.push( |
| 490 | `Found ${warns.length} keybinding ${plural(warns.length, 'warning')}:`, |
| 491 | ) |
| 492 | for (const w of warns) { |
| 493 | lines.push(formatWarning(w)) |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | return lines.join('\n') |
| 498 | } |
| 499 |
nothing calls this directly
no test coverage detected