Sift: The Lisp formatter I kept trying to write (+lint and LSP) jointhefreeworld...

@best

Sift: The Lisp formatter I kept trying to write (+lint and LSP) jointhefreeworld.org · 13 points · 8 comments · HN thread

TL;DR sift is an MIT-licensed Guile program that acts as a formatter, linter (95 rules, codes SIFT001–SIFT095) and LSP server for Scheme, Racket, Emacs Lisp and Common Lisp, with a WebAssembly browser build. The article is the author's account of the failed attempts (keyboard macros, Emacs batch indentation, guix style, pretty-printers) that led to it, plus design principles, benchmarks and a roadmap.

  • Formatting is idempotent and never reflows lines; the author says a Prettier-style pretty-printer made a 300-line file diff on every line, which led to the no-reflow rule.
  • The tool has 95 lint rules with stable codes, JSON/SARIF/GitHub output, and fixes that are discarded if they introduce a parse error.
  • The LSP deliberately refuses features such as call hierarchy and semantic tokens rather than guessing; it indexes standard library sources for jump-to-definition.
  • Benchmarks: linting a 28-file, 14,896-line tree takes 337 ms; a screenful formats in 17 ms in the browser build, a 6 kB file takes about 780 ms to format and 1.2 s to lint.
  • Installable via Guix, Nix, Homebrew, a container, or a checkout; the Emacs package needs Emacs 28.1 and no other dependencies.
  • Planned work includes range formatting, a --since REV mode for linting only changed lines, cross-file resolution and a declared-macro table.

Discussion The thread is small and mostly skeptical of the article rather than of the tool. The first commenters said the text reads as LLM-generated, and one replied that the formatter itself was AI-built, which turned into a broader criticism of building tooling around work the author no longer does by hand. Another commenter argued that Lisp formatting is largely a solved problem because indentation conventions have been settled for decades and Lisp-aware editors handle it, so the length of the write-up looked out of proportion. The most substantive reply accepted that point but noted that non-Lisp-aware editors and generated code still need a predictable formatter, and that a gofmt-style tool for Lisp is useful in that niche.

  • Article reads as AI-generated text (many): Several commenters said the prose has the hallmarks of LLM output and expressed irritation at that, with some saying they now assume such text is machine-written by default.
  • Building tooling with AI undermines the project (some): One commenter suggested that building formatters with AI while no longer writing code by hand is a kind of pointless ritual, and wondered what motivates that.
  • Lisp indentation is already a solved problem (some): A commenter argued that Lisp syntax makes formatting mostly about indentation, that a common style was set long ago, and that Lisp-aware editors already do this well, so the article's length is surprising.
  • A formatter is still useful for non-Lisp-aware editors and generated code (a few): A commenter who wrote a gofmt-like tool for Lisp said predictable reformatting matters when users work in editors without Lisp support or when code is generated.
  • The article's workflow is an overreach of CI and editor conflicts (a few): One commenter noted that the author's setup had CI auto-formatting fighting the editor, and said most people would simply disable the CI formatter.

#lisp #formatter #linter #languageServer #scheme #emacs