Builtin Library
README.md
strictModeToggle
Three-button radio for the LSP strict gate. Pass the current mode
("off" | "soft" | "strict" — exactly what lsp.getStrictMode()
returns) and a callback prefix; emits <onChange>-<mode> when a
button is clicked. The widget is presentational only — the owning app
calls lsp.setStrictMode() from its handler and mirrors the change
back into its render state.
Exports
strictModeToggle(currentMode: string?, onChange: string?, opts: Opts?) -> any— build the hbox of mode buttons. Returned directly by the module.
Types:
Opts = { id?: string, label?: any, padding?: { number }, containerPadding?: { number } }
Usage
local strictToggle = require("@builtin::modules.zui.widget.lsp.strictModeToggle")
local widget = strictToggle(lsp.getStrictMode(), "lsp-strict")
app:on("^lsp%-strict%-(.+)$", function(_v, _id, mode)
lsp.setStrictMode(mode)
state.strictMode = mode
end)
Notes
- Decouples the visual from the side effect — matches the rest of the zui composite-widget convention so screens stay testable without an active LSP.
- Pass
opts.label = falseto drop the leading label entirely (e.g. for compact inspectors that already provide context). - Tooltips on each button explain exactly which classes of error are gated at that level.