Builtin Library
README.md
diagnosticDetail
Detail pane for a single LSP diagnostic. Renders a severity / code
header, an optional file:line:col row (with optional copy-path
button), the message and suggestion, and an optional source snippet
around the offending line. Stateless builder — pass a diagnostic in,
get a widget tree out.
Exports
diagnosticDetail(d: Diagnostic?, opts: DiagnosticDetailOpts?) -> WidgetNode— module returns the builder function directly. Also reachable viaZ.lsp.diagnosticDetail.
Options:
id: string?— id forwarded to the outer panel.source: string?— full file contents. Enables the snippet panel.snippetContext: number?— lines of context around the focused line. Default2.onCopyPath: string?— callback prefix for the copy-path button. Emits<prefix>-copywhen clicked. Omit to hide the button.
d shape (from lsp.check*): { severity, code?, path?, line?, col?, message?, suggestion? }.
Usage
local Z = require("@builtin::modules.zui")
Z.lsp.diagnosticDetail(diags[selected], {
source = source,
onCopyPath = "lsp:path",
})
Notes
- When
disnil, renders a placeholder panel ("Select a diagnostic to see details.") rather than crashing. - The widget never copies to the clipboard itself — it only emits a
callback. The parent app decides what "copy" means in its host
(some have
ui.copy(text), others log to stdout). - The snippet renders only when both
opts.sourceandd.lineare provided. - Severity colours come from
Theme.default(danger,warn,info,text_dim); unknown severities fall back totheme.text.