Version0.16.3Verifiednot yet verifiedLicenseBSD-3-Clause

sigil-format

Sigil code formatter (paren-inference + AST-aware reflow)

Report a bug or suggest a feature
Readme

sigil-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 records

Modules

ModulePurpose
(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-stdlib
  • sigil-json — only used by the (sigil format json) submodule for the --format json CLI output

Build & Test

sigil deps install
sigil build
sigil test --report

License

BSD-3-Clause

Clone

$ git clone https://codeberg.org/sigil/sigil-format

Releases

v0.16.3 — latest by version, released 16 Jul 2026

All releases — 7 tags in this repository.

Source

Browse the latest source

One page per file, and every line has a permalink.

Recent commitsAtom

The last 20 commits keep a page here. Everything older lives in the clone.