Log inGet started
Package

lsp.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

diagnosticsList

Scrollable list of LSP diagnostics. Input shape matches the array returned by lsp.check() / lsp.checkAll().diagnostics / lsp.checkDirty(). Each row shows a severity dot, location (path:line:col), code chip, and message. Clicking a row emits the callback id <onSelect>-<idx> (1-based) so the owning app can route it back into its selection state.

Exports

  • diagnosticsList(diags: { Diagnostic }?, onSelect: string?, opts: Opts?) -> any — build the scrollable widget. Returned directly by the module.

Types:

  • Diagnostic = { severity?: string, line?: number, col?: number, code?: string, message?: string, suggestion?: string, path?: string }
  • Filter = { severity?: string, code?: string, pathSubstr?: string }
  • Opts = { id?: string, filter?: Filter, maxRows?: number, messageMax?: number, maxHeight?: number, emptyMessage?: string }

Usage

local diagList = require("@builtin::modules.zui.widget.lsp.diagnosticsList")

local widget = diagList(lsp.check(), "lsp-row", {
    filter   = { severity = "error" },
    maxRows  = 50,
    maxHeight = 320,
})

app:on("^lsp%-row%-(%d+)$", function(_v, _id, idx)
    state.selected = tonumber(idx)
end)

Notes

  • opts.maxRows defaults to 200 — overflow paints a "+N more" footer chip rather than rendering thousands of rows.
  • Messages are truncated to opts.messageMax characters (default 200) with an ellipsis so a single huge diagnostic doesn't push the layout.
  • Severity colors flow from the active theme — danger / warn / info / text_dim for error / warning / info / hint.
  • The list is presentational only — it does NOT call lsp.*. The caller supplies the diagnostics array (and re-renders with a new array when the underlying check refreshes).