-
released this
2026-11-19 10:40:32 -08:00 | 8 commits to master since this releaseNamed formatting styles
(
docs/features/format-styles; TODO §71.5.)-
One setting picks a house layout.
[format] style = "<name>"in
lucisv.toml,--style <name>on the command line, or the new
lucisv.format.styledrop-down in VS Code. Seven layout rules, one row per
style, in one table incrates/vlog_formatter/src/style.rs:style indent / width beginelselists list indent alignment lucisv(default)2 / 100 same line same line fit 1 level keep google2 / 100 same line same line one per line 2 levels keep lowrisc2 / 100 same line same line one per line 1 level always ansi4 / 80 own line own line fit 1 level keep microsoft4 / 120 own line own line one per line 1 level keep nxp2 / 80 same line own line one per line 1 level always -
Where the styles come from.
googlefollows the Google Verilog Style
Guide andlowriscthe lowRISC (OpenTitan) guide, both read for this
release, includingelseon its own line after a labelledend.ansi,
microsoftandnxpare lucisv's educated guesses — Allman-style
begin/elseafter iStyle's and clang-format's styles of those names, and
a conservative aligned RTL style — not rules those organisations publish
for Verilog. -
The default does not move a byte.
lucisvoutput is identical to
0.65.4 on all 4 921 files of the corpus and OpenTitan'shwtree, checked
against an independently rebuilt 0.65.4. An explicitindentor
line-lengthstill wins over a style's. -
Every style goes through the same safety net. Each was formatted three
times over those 4 921 files: no verification error, no crash, no token or
comment difference (checked with a lexer that is not the formatter's), and
no change on a second or third run.verify.rsis untouched. -
style = "auto"keeps a file in the layout it is already closest to.
It formats with each preset and keeps the result that changes the fewest
lines, so a file written the Google way stays that way. It picks a layout
for the configured indent and width and never infers them — set
indentto match the file first, or a 4-space file formatted at the
default 2 comes out in the default layout. Small edits do not flip a file:
over 500 files and ten kinds of edit, none rewrote more than 12 lines
outside the edit.autocosts a search — 2.4 s against 0.4 s on a
42 000-line file for a whole-document format — so the language server
remembers each document's layout, and selection and on-type formatting stay
at 0.1 s after the first request. -
Known limits. A declaration with several instances in one statement
gets the older hanging layout under the one-per-line styles. The language
server'sline-lengthlint still assumes 100 columns underansi,
microsoftandnxp(the CLI'scheckfollows the style). Switching from
one keep-alignment style to another and back is not always a round trip:
alignment a style added stays.
Downloads
-