Editor Setup
Badness ships a language server. Start it with:
badness lsp
The server speaks the Language Server Protocol over stdio. Point your
editor’s LSP client at the badness binary with the lsp argument and
associate it with LaTeX (.tex) and BibTeX (.bib) files.
Formatter width settings can be supplied as initializationOptions at startup
or through workspace/didChangeConfiguration: lineWidth and indentWidth,
either as a bare object or namespaced under a badness key. They act as a
fallback: a discovered badness.toml always wins outright, and absent one, your
editor’s tab size (sent with each formatting request) overrides the indent
width.
Neovim
With the built-in vim.lsp client (Neovim 0.11+):
vim.lsp.config.badness = {
cmd = { "badness", "lsp" },
filetypes = { "tex", "latex", "plaintex", "bib" },
root_markers = { "badness.toml", ".git" },
init_options = { lineWidth = 80, indentWidth = 2 },
}
vim.lsp.enable("badness")
The init_options block is optional; omit it to use the defaults or a
badness.toml.
VS Code
Install the Badness
extension
from the VS Code Marketplace or the Open VSX
extension. It bundles a
platform-specific badness binary and starts the language server automatically
when you open a .tex file, so no separate CLI install is required.
The extension is configured through badness.* settings. By default it uses the
bundled binary (badness.executableStrategy: "bundled"); set the strategy to
environment to use a badness on your PATH, or path with
badness.executablePath to point at a specific binary. See the extension’s
README for the full list of settings.
Other Editors
Any LSP-capable editor can drive badness: configure a server whose command is
badness lsp, communicating over stdio, for LaTeX documents. Consult your
editor’s LSP client documentation for the exact configuration shape.
The language server is young; the set of supported LSP requests will expand. Track progress in the Changelog.