Skip to content

Commit

Permalink
Remove AD_HOC_FORMATTING from the IntelliJ plugin.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
plumpy authored and google-java-format Team committed Apr 4, 2023
1 parent 401d5c9 commit 25ce685
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions idea_plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -37,7 +37,7 @@ intellij {

tasks {
patchPluginXml {
version.set("${googleJavaFormatVersion}.1")
version.set("${googleJavaFormatVersion}.2")
sinceBuild.set("213")
untilBuild.set("")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private static Formatter createFormatter(Style style, boolean canChangeWhiteSpac

@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,7 +38,7 @@ class GoogleJavaFormatSettings implements PersistentStateComponent<GoogleJavaFor
}

static GoogleJavaFormatSettings getInstance(Project project) {
return ServiceManager.getService(project, GoogleJavaFormatSettings.class);
return project.getService(GoogleJavaFormatSettings.class);
}

@Nullable
Expand Down
2 changes: 2 additions & 0 deletions idea_plugin/src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 25ce685

Please sign in to comment.