Skip to content

Daemonized headless formatter

Choose a tag to compare

@javanoo6 javanoo6 released this 30 Apr 15:46
· 10 commits to master since this release

Run The Formatter

Basic shape:

java -jar formatter-cli/target/formatter-cli-full.jar \
  --format \
  --optimize-imports \
  --rearrange \
  --editorconfig /absolute/path/to/.editorconfig \
  /absolute/path/to/File.java

Daemon Mode

By default, the formatter runs in daemon mode. On the first call, a background IntelliJ JVM is started and kept alive. Subsequent calls connect to it directly, skipping the 3–5 second startup cost.

First call  (~5s): engine extracted, daemon started, file formatted
Second call (<1s): connects to running daemon, file formatted instantly

The daemon port is stored in $TMPDIR/intellij-formatter-daemon-*.port.
Daemon logs go to $TMPDIR/intellij-formatter-daemon-*.log.

Stop the daemon

java -jar formatter-cli/target/formatter-cli-full.jar --stop-daemon