feat(fmt): go-fmt-style recursive formatting and canonical blank-line layout

Assisted-by: Qwen 3.8 Max Preview
This commit is contained in:
2026-07-12 21:24:41 +02:00
parent 1a01870695
commit e98680597d
6 changed files with 266 additions and 30 deletions
+9 -3
View File
@@ -157,9 +157,15 @@ Two deeper analyses sit on top of the AST:
### `format`
The formatter works on the **token stream, not the AST**, so it preserves
every line — comments and blanks included. It only normalises indentation,
operand spacing and per-function mnemonic alignment. It is idempotent and its
output always round-trips through the parser.
every line — comments and blanks included. It normalises indentation, operand
spacing, per-function mnemonic alignment and blank-line layout: a new block
(a label, `TEXT` or `GLOBL`) is preceded by exactly one blank line (comments
leading a block stay with it), runs of blanks collapse to one, and a `RET`
terminates the body so the next function's doc comment stays at column 0. It
is idempotent and its output always round-trips through the parser. With a
directory argument — or none — it reformats every `.s` file below it in
place and lists the files changed, the way `go fmt` does (`.` and `_`
directories are skipped).
### `lsp`