fix(diagnostics): sort by severity before truncating

Errors appear first, then warnings, info, hints. Ensures the most
actionable issues survive the cap instead of being pushed out by
low-priority hints.
This commit is contained in:
2026-05-02 20:24:35 -04:00
parent 01ab10a7d9
commit f811efef68

View File

@@ -219,6 +219,10 @@ function formatDiagnostics(result: unknown, limit = 20): string {
4: "Hint",
};
// Sort By Severity - Errors first, then warnings, info, hints. Ensures
// the most actionable issues survive truncation.
diags.sort((a: any, b: any) => (a.severity ?? 99) - (b.severity ?? 99));
const shown = diags.slice(0, limit);
const formatted = shown
.map((d: any, i: number) => {