severitySummary.module
This package holds more than this page lists. See all of its files in its world.
README.md
severitySummary
Colored badge row of LSP diagnostic severity counts. Input shape
matches lsp.summary() / lsp.checkAll() — { errors, warnings, info, hints }. Severities with zero count are hidden by default; pass
opts.showZero = true to keep them in the row. When all counts are
zero the widget falls back to a neutral "0 diagnostics" chip so the
header doesn't collapse.
Exports
severitySummary(counts: Counts?, opts: Opts?) -> any— build the hbox of severity chips. Returned directly by the module.
Types:
Counts = { errors?: number, warnings?: number, info?: number, hints?: number }Opts = { id?: string, showZero?: boolean, tooltips?: boolean, gap?: number, padding?: { number } }
Usage
local severitySummary = require("@builtin::modules.zui.widget.lsp.severitySummary")
local widget = severitySummary(lsp.summary(), { tooltips = true })
Notes
- Chip colors flow from
Z.theme.danger / warn / info / successso the palette automatically tracks theme overrides. - The "0 diagnostics" fallback prevents the parent layout from jumping when diagnostics first appear — important for fixed-height headers.
- Pure presentational — no LSP calls, no side effects.