Installing formatters
Edit ▸ Format Document (⌥⇧⌘F) tidies the whole file in one step, and it can be undone like any other edit. Web files are formatted by a copy of Prettier built into Incise. Other languages use the same command-line formatter you’d run in a terminal, which you install once.
Settings ▸ Formatter shows which ones Incise can find: a green check means it’s ready, a red cross means it isn’t installed yet.
Built in: Prettier
Nothing to install, in both editions. Prettier formats:
Other languages: install once
These run in the free Homebrew and direct-download edition. Each is one Homebrew command; if you don’t have Homebrew yet, get it from brew.sh first. Paste the command into Terminal (or Incise’s built-in terminal), then quit and reopen Incise.
| Language | Formatter | Install |
|---|---|---|
| Python.py | Black | brew install black |
| Go.go | gofmt | brew install gogofmt comes with Go. |
| Rust.rs | rustfmt | brew install rustAlready have Rust through rustup? rustfmt is part of its default install. |
| SQL.sql | SQLFluff | brew install sqlfluffUses your project's dialect, or ANSI if none is set. |
| C, C++, Objective-C.c .h .cpp .cc .cxx .m .mm | clang-format | brew install clang-format |
| Swift.swift | swift-format | brew install swift-format |
| Perl.pl .pm .t | perltidy | brew install perltidy |
Installed some other way (pipx, pyenv, conda, a language’s own installer)? That works too. See where Incise looks, below.
Your project’s settings
Each formatter follows the same settings file it would on the command line in your project: pyproject.toml for Black, .sqlfluff for SQLFluff (dialect included), rustfmt.toml, .clang-format, .swift-format and .perltidyrc, even when it sits in a folder above the file you’re editing. A personal one in your home folder (~/.sqlfluff, ~/.perltidyrc) applies where the project has none.
If a formatter isn’t found
- Quit and reopen Incise. It reads your shell’s
PATHwhen it starts, so a tool installed while it was running may not show up until then. - Where Incise looks: everywhere on your login shell’s
PATH(the one a new Terminal window gets, so pyenv, conda and pipx set-ups are included), plus/opt/homebrew/bin,/usr/local/bin,~/.local/binand~/.pyenv/shims. Check a tool is on yourPATHwithwhich black(or the tool’s name) in Terminal. - “Format failed” in the status bar is the formatter’s own error, usually about a syntax error in the file.
- A problem in a settings file gets a sheet instead, because every format fails until it’s fixed. It shows everything the formatter said, and its Open button takes you to the settings file at the line responsible when that can be worked out. For SQL, it can come from a personal
~/.sqlfluff: SQLFluff reads it for every file, so one that names a templater plugin your copy of SQLFluff doesn’t have (dbt or Dataform, say) stops every format. Incise names the plugin, and offers the command that installs it where it can tell how SQLFluff was installed. - “Formatter timed out” means the tool took longer than 5 seconds, which is usually a very large file or a first run that’s still setting itself up. Try once more.
Mac App Store edition
Prettier works there too. Command-line formatters don’t: App Store apps run in a sandbox that can’t start other programs, so Settings ▸ Formatter shows them all as unavailable. The free Homebrew edition is the same app without that limit.