Remove AD_HOC_FORMATTING from the IntelliJ plugin. I have a feeling this is causing a lot of the issues people are seeing where it's constantly trying to reformat and failing because of syntax errors. Hopefully this will make it only try to reformat when a user specifically requests it. PiperOrigin-RevId: 521657519
diff --git a/idea_plugin/build.gradle.kts b/idea_plugin/build.gradle.kts index a05b0cb..474c24d 100644 --- a/idea_plugin/build.gradle.kts +++ b/idea_plugin/build.gradle.kts
@@ -14,7 +14,7 @@ * limitations under the License. */ -plugins { id("org.jetbrains.intellij") version "1.13.2" } +plugins { id("org.jetbrains.intellij") version "1.13.3" } apply(plugin = "org.jetbrains.intellij") @@ -37,7 +37,7 @@ tasks { patchPluginXml { - version.set("${googleJavaFormatVersion}.1") + version.set("${googleJavaFormatVersion}.2") sinceBuild.set("213") untilBuild.set("") }
diff --git a/idea_plugin/src/main/java/com/google/googlejavaformat/intellij/GoogleJavaFormatFormattingService.java b/idea_plugin/src/main/java/com/google/googlejavaformat/intellij/GoogleJavaFormatFormattingService.java index 150a739..9d2d7a5 100644 --- a/idea_plugin/src/main/java/com/google/googlejavaformat/intellij/GoogleJavaFormatFormattingService.java +++ b/idea_plugin/src/main/java/com/google/googlejavaformat/intellij/GoogleJavaFormatFormattingService.java
@@ -74,7 +74,7 @@ @Override public @NotNull Set<Feature> getFeatures() { - return Set.of(Feature.AD_HOC_FORMATTING, Feature.FORMAT_FRAGMENTS, Feature.OPTIMIZE_IMPORTS); + return Set.of(Feature.FORMAT_FRAGMENTS, Feature.OPTIMIZE_IMPORTS); } @Override
diff --git a/idea_plugin/src/main/java/com/google/googlejavaformat/intellij/GoogleJavaFormatSettings.java b/idea_plugin/src/main/java/com/google/googlejavaformat/intellij/GoogleJavaFormatSettings.java index ad740b2..ee187c0 100644 --- a/idea_plugin/src/main/java/com/google/googlejavaformat/intellij/GoogleJavaFormatSettings.java +++ b/idea_plugin/src/main/java/com/google/googlejavaformat/intellij/GoogleJavaFormatSettings.java
@@ -18,7 +18,6 @@ import com.google.googlejavaformat.java.JavaFormatterOptions; import com.intellij.openapi.components.PersistentStateComponent; -import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; import com.intellij.openapi.project.Project; @@ -39,7 +38,7 @@ } static GoogleJavaFormatSettings getInstance(Project project) { - return ServiceManager.getService(project, GoogleJavaFormatSettings.class); + return project.getService(GoogleJavaFormatSettings.class); } @Nullable
diff --git a/idea_plugin/src/main/resources/META-INF/plugin.xml b/idea_plugin/src/main/resources/META-INF/plugin.xml index d59c3c2..42011a2 100644 --- a/idea_plugin/src/main/resources/META-INF/plugin.xml +++ b/idea_plugin/src/main/resources/META-INF/plugin.xml
@@ -35,6 +35,8 @@ ]]></description> <change-notes><![CDATA[ <dl> + <dt>1.16.0.2</dt> + <dd>Disable AD_HOC_FORMATTING, which should stop the formatter from running so often when it wasn't specifically requested. <dt>1.16.0.1</dt> <dd>When the plugin isn't configured correctly, show the error on every format command. Previously it was only being shown at startup and going