@@ -35,7 +35,7 @@ A version that is not on the Marketplace yet can be installed from a release.
3535
3636The plugin is off in every project until you turn it on.
3737
38- 1 . Open ** Settings** and go to ** Other Settings → open-java-format Settings** .
38+ 1 . Open ** Settings** and go to ** Tools → open-java-format Settings** .
39392 . Tick ** Enable open-java-format** .
4040
4141![ The open-java-format Settings page with Enable open-java-format ticked] ( ../assets/images/intellij-enable.webp ) { width="565" height="455" loading="lazy" }
@@ -58,26 +58,52 @@ Limiting it to Java keeps other files out: the IDE would reformat those with its
5858## Which formatter version runs
5959
6060A project that applies the [ Gradle plugin] ( gradle.md ) takes the formatter version from the build.
61- Every other project uses the version bundled with the IDE plugin, which the settings page shows as
62- ` (bundled) ` under ** Implementation version** , as in the screenshot above.
61+ Every other project uses the version bundled with the IDE plugin.
6362
6463By default the formatter runs in a process of its own, on the IDE's runtime, so the project SDK can
6564be any version.
6665
6766## Native binary
6867
69- In a project with the [ Gradle plugin] ( gradle.md ) , the IDE can run the formatter as the native binary
70- that the build uses. It is switched on in the build, not in the IDE:
68+ Reformat Code starts the formatter as a new process for every file, and the Java-based formatter
69+ starts a JVM each time, which a whole directory makes you feel. The native binary starts without
70+ one: on an Apple silicon Mac a file takes about 40 ms instead of 430 ms.
7171
72- ``` properties title="gradle.properties"
73- openjavaformat.native.formatter =true
74- ```
72+ It is a setting of the IDE and works in any project, whether Maven, Gradle or neither builds it.
7573
76- After the next Gradle sync in the IDE, the plugin writes the path of the binary into
77- ` .idea/open-java-format.xml ` , and ** Formatter type** on the settings page changes from
78- ** Java-based formatter** to ** Native image formatter** . Each reformat starts the formatter as a new
79- process, and the native binary starts without a JVM.
74+ 1 . Open ** Settings** and go to ** Tools → open-java-format Settings** .
75+ 2 . Tick ** Use native binary** , which shows while ** Enable open-java-format** is ticked.
76+ 3 . Click ** Download** next to ** No embedded version.** The IDE downloads the binary of the plugin's
77+ version for your platform from Maven Central, checks it against its SHA-256 checksum and keeps
78+ it for every project. The line then reads ** Use embedded version** and the version.
79+ 4 . Click ** OK** . Until there is a binary to run, OK says so and keeps the page open.
8080
81- The binary runs on the platforms listed on the
82- [ Gradle plugin] ( gradle.md#choose-how-the-formatter-runs ) page. Elsewhere the plugin ignores the
83- property, and the IDE keeps the Java-based formatter.
81+ ** Active formatter** at the bottom of the page names what runs once you click OK, and follows the
82+ page as you change it: the Java-based formatter, the binary's path, or the version that still
83+ needs downloading. ` idea.log ` has a line starting with ` open-java-format: using ` each time the
84+ plugin starts a formatter.
85+
86+ !!! note "Projects that set ` openjavaformat.native.formatter ` "
87+
88+ Up to 21.0.1 that Gradle property also switched the IDE to the native binary. It now applies to
89+ the build alone, so tick **Use native binary** once in such a project.
90+
91+ ### A binary of your own
92+
93+ To run another binary, such as one from the [ command line] ( command-line.md ) page, choose it in
94+ ** Binary** under ** Use native binary** . It takes the place of the embedded one; empty the field to
95+ go back to the embedded binary.
96+
97+ ### After an update of the plugin
98+
99+ The binary of the previous version keeps formatting. When a project opens, a notification says
100+ that a newer one is available, with ** Download** and ** Ignore** ; Ignore holds until the plugin's
101+ next version. The settings page offers the same at any time: while the binary is of another version
102+ than the plugin, ** Update to** and the plugin's version stand next to it. Once the newer binary is
103+ in, the old one is deleted.
104+
105+ ### Platforms
106+
107+ The binary is published for Linux with glibc on x86-64 and AArch64, macOS on Apple silicon and
108+ Intel, and Windows on x86-64. Anywhere else, such as Windows on ARM or Alpine, the settings page
109+ says there is none and the Java-based formatter runs, unless you choose a binary of your own.
0 commit comments