sigil-format
Sigil code formatter (paren-inference + AST-aware reflow)
❦Report a bug or suggest a featuresigil-format
Code formatter for Sigil with paren-inference and AST-aware reflow.
Sigil's formatter reads a source file, tokenizes it, and uses indentation as a hint to infer missing or surplus parentheses. Where indentation and parens disagree, the indentation wins — the formatter rewrites the parens to match. The output is canonically formatted with consistent indentation.
This package was extracted from the sigil monorepo — the in-tree history under packages/sigil-format/ is preserved here as master.
It backs the sigil format CLI subcommand and is used by editor / LSP plugins for in-place formatting.
Usage
(import (sigil format))
;; Format a file on disk
(format-file "src/example.sgl")
; => <format-result>
;; Format a string in memory
(format-string "(define (foo\n x\n (+ x 1))" "test.sgl")
; => <format-result>The result record exposes the formatted output along with diagnostics:
(let ((result (format-file "src/example.sgl")))
(format-result-success result) ; #t/#f
(format-result-output result) ; formatted source string
(format-result-errors result) ; list of <format-error>
(format-result-warnings result) ; list of <format-warning>
(format-result-inferences result)) ; list of inferred-paren recordsModules
| Module | Purpose |
|---|---|
(sigil format) | Core formatter — format-file, format-string, result + diagnostic records |
(sigil format json) | JSON output of format results, used by sigil format --format json (lazy-loaded post-bootstrap) |
Dependencies
sigil-stdlibsigil-json— only used by the(sigil format json)submodule for the--format jsonCLI output
Build & Test
sigil deps install
sigil build
sigil test --reportLicense
BSD-3-Clause
$ git clone https://codeberg.org/sigil/sigil-format
v0.16.3 — latest by version, released 16 Jul 2026
All releases — 7 tags in this repository.
One page per file, and every line has a permalink.
2e7002da
Bump sigil-format dependencies
d3e2557f
fc7a45b2
The last 20 commits keep a page here. Everything older lives in the clone.