Skip to content

Commit 91d1381

Browse files
committed
Switch to DocumentFormattingService interface
Upgrade to IntelliJ IDEA 2022.3.2 and change the formatter to be an implementation of `DocumentFormattingService`. This significantly simplifies the plugin and hopefully removes some of the compatibility issues that have happened in the past. Closes gh-359
1 parent 759dfdf commit 91d1381

27 files changed

+527
-1247
lines changed

Diff for: README.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ or use the https://repo.spring.io/javaformat-eclipse-update-site/[update site].
224224

225225
=== IntelliJ IDEA
226226
The IntelliJ IDEA plugin provides custom formatter support for IntelliJ IDEA.
227-
The plugin is automatically activated whenever the Maven or Gradle plugins are discovered in a project build script.
227+
The plugin is automatically activated whenever the Maven or Gradle plugins are discovered in a project build script or if a `.springjavaformatconfig` file.
228228
A Spring Java Format icon (image:spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/src/main/resources/spring-javaformat/formatOn.png[title="Icon"]) will also be displayed in the status bar to indicate the formatter is active.
229229
You can use the standard `code` -> `reformat code` action to format the code.
230230

Diff for: spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/pom.xml

+28-10
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@
1212
<name>Spring JavaFormat IntelliJ IDEA Plugin</name>
1313
<properties>
1414
<main.basedir>${basedir}/../..</main.basedir>
15-
<java.version>11</java.version>
15+
<java.version>17</java.version>
1616
</properties>
1717
<dependencies>
1818
<!-- Compile -->
19-
<dependency>
20-
<groupId>io.spring.javaformat</groupId>
21-
<artifactId>spring-javaformat-formatter</artifactId>
22-
<version>${project.version}</version>
23-
</dependency>
2419
<dependency>
2520
<groupId>io.spring.javaformat</groupId>
2621
<artifactId>spring-javaformat-formatter-eclipse-runtime</artifactId>
@@ -32,6 +27,11 @@
3227
</exclusion>
3328
</exclusions>
3429
</dependency>
30+
<dependency>
31+
<groupId>io.spring.javaformat</groupId>
32+
<artifactId>spring-javaformat-formatter</artifactId>
33+
<version>${project.version}</version>
34+
</dependency>
3535
<!-- Provided -->
3636
<dependency>
3737
<groupId>io.spring.javaformat</groupId>
@@ -41,14 +41,20 @@
4141
<scope>provided</scope>
4242
</dependency>
4343
<dependency>
44-
<groupId>io.spring.javaformat.intellij.idea</groupId>
44+
<groupId>org.jetbrains</groupId>
4545
<artifactId>annotations</artifactId>
46+
<version>13.0</version>
47+
<scope>provided</scope>
48+
</dependency>
49+
<dependency>
50+
<groupId>io.spring.javaformat.intellij.idea</groupId>
51+
<artifactId>app</artifactId>
4652
<version>${project.version}</version>
4753
<scope>provided</scope>
4854
</dependency>
4955
<dependency>
5056
<groupId>io.spring.javaformat.intellij.idea</groupId>
51-
<artifactId>platform-api</artifactId>
57+
<artifactId>jps-model</artifactId>
5258
<version>${project.version}</version>
5359
<scope>provided</scope>
5460
</dependency>
@@ -66,7 +72,7 @@
6672
</dependency>
6773
<dependency>
6874
<groupId>io.spring.javaformat.intellij.idea</groupId>
69-
<artifactId>idea</artifactId>
75+
<artifactId>util_rt</artifactId>
7076
<version>${project.version}</version>
7177
<scope>provided</scope>
7278
</dependency>
@@ -78,7 +84,7 @@
7884
</dependency>
7985
<dependency>
8086
<groupId>io.spring.javaformat.intellij.idea</groupId>
81-
<artifactId>maven-server-api</artifactId>
87+
<artifactId>maven-server</artifactId>
8288
<version>${project.version}</version>
8389
<scope>provided</scope>
8490
</dependency>
@@ -110,6 +116,18 @@
110116
<artifactId>picocontainer</artifactId>
111117
<scope>provided</scope>
112118
</dependency>
119+
<dependency>
120+
<groupId>org.jetbrains.kotlinx</groupId>
121+
<artifactId>kotlinx-coroutines-core</artifactId>
122+
<version>1.6.4</version>
123+
<scope>provided</scope>
124+
</dependency>
125+
<dependency>
126+
<groupId>it.unimi.dsi</groupId>
127+
<artifactId>fastutil</artifactId>
128+
<version>8.5.11</version>
129+
<scope>provided</scope>
130+
</dependency>
113131
</dependencies>
114132
<build>
115133
<resources>

Diff for: spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/src/main/java/io/spring/format/formatter/intellij/SpringFormat.java

-160
This file was deleted.

0 commit comments

Comments
 (0)