Formatters

Known formatters

Here is a list of all the formatters we tested. Feel free to send a PR to add other ones!

Python

command = "black"
includes = ["*.py"]

Elm

-format

command = "elm-format"
options = ["--yes"]
includes = ["*.elm"]

Golang

command = "gofmt"
options = ["-w"]
includes = ["*.go"]

Haskell

Make sure to use ormolu 0.1.4.0+ as older versions don't adhere to the spec.
command = "ormolu"
options = [
"--ghc-opt", "-XBangPatterns",
"--ghc-opt", "-XPatternSynonyms",
"--ghc-opt", "-XTypeApplications",
"--mode", "inplace",
"--check-idempotence",
]
includes = ["*.hs"]

command = "stylish-haskell"
options = [ "--inplace" ]
includes = [ "*.hs" ]

Nix

command = "nixpkgs-fmt"
includes = ["*.nix"]

Rust

cargo fmt is not supported as it doesn't follow the spec. It doesn't allow to pass arbitrary files to be formatter, an ability which `treefmt` relies on. Use rustfmt instead (which is what cargo fmt uses under the hood).

command = "rustfmt"
options = ["--edition", "2018"]
includes = ["*.rs"]

Ruby

Rufo is an opinionated ruby formatter. By default it exits with status 3 on file change so you have to pass the -x option.
command = "rufo"
options = ["-x"]
includes = ["*.rb"]

Shell

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.