You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Before commit reformatting option in IntelliJ does invoke plugin #228
I have the IntelliJ plugin installed and reformatting works as expected. If I select 'Reformat code' option in commit window, then it will take my currently selected Code Style sheet and not use google-java-format. It sets indentation to 4 spaces instead of 2 for example. Reformatting after committing then immediately gives local changes.
Is this a known issue? Will this be solved?
Reacted by Coda Hale, Ashton Batty, Roland Illig, Darong Mean, Alexander Bellhäuser, Gino Miceli, Fleur Kelpin, sgrimm-sg, Michael Leonhard, Tommy de boer and 16 more
My setup is:
IntelliJ @ IU-173.4548.28
google-java-format plugin @ 1.6.0
You are describing a different problem @codahale. Apparently 'Reformat code' in the commit dialog is doing nothing for you. My problem was that 'Reformat code' in the commit dialog was actually changing the files but without using the google-java-format plugin, hence falling back to my Code Style Sheet.
That should probably be filed as a separate issue, but that is not my call to make. This issue can be closed for my part.
Actually, no — I can confirm w/ 2018.1.5/IU-181.5281.24 that it uses the Code Style settings and not google-java-format. This was always the problem I was experiencing, but perhaps I didn’t describe it well.
I really wish I could use the automatic formatter.
IntelliJ IDEA 2019.1.1 (Community Edition)
Build #IC-191.6707.61, built on April 16, 2019
JRE: 1.8.0_202-release-1483-b44 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.4
google-java-format v1.7.0.1
@plumpy Please fix? This issue and #264 are assigned to you and have been ignored for 2 years.
@YanzheL We're doing the same as workaround. We used plugin google-java-format for a while but not being able to use before commit action is confusing and frustrating our developers. This is a show stopper for us.
Last tested on
IntelliJ IDEA 2019.1.3 (Ultimate Edition)
Build #IU-191.7479.19, built on May 28, 2019
JRE: 1.8.0_202-release-1483-b58 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Also observing the same issue. The workaround with the codestyle.xml is nice, but the formatting can be wildly different. Especially regarding annotations (on single line, annotation indentation, ...) so the workaround is in the end not really sufficient as you still have to always apply the style either manually or via a maven plugin.
Activity
mqzry commentedon Jan 17, 2018
What's the status? Should I try to fix it myself?
plumpy commentedon Jun 4, 2018
Hey there,
I tried to reproduce this, but was not able to. It's very old, though, so maybe it got fixed in some interim version.
Can you still reproduce it? What version of the plugin do you have and what version of the IDE?
Thanks and sorry for the delay...
codahale commentedon Jun 4, 2018
This is still a problem with 1.6.0 of the plugin and the latest version of IntelliJ (2018.1.4/IU-181.5087.20).
To reproduce:
mqzry commentedon Jun 16, 2018
I tried it out again and it seems to be fixed.
My setup is:
IntelliJ @ IU-173.4548.28
google-java-format plugin @ 1.6.0
You are describing a different problem @codahale. Apparently 'Reformat code' in the commit dialog is doing nothing for you. My problem was that 'Reformat code' in the commit dialog was actually changing the files but without using the google-java-format plugin, hence falling back to my Code Style Sheet.
That should probably be filed as a separate issue, but that is not my call to make. This issue can be closed for my part.
codahale commentedon Jun 16, 2018
Well, now I can’t reproduce my problem either, so I assume this is fixed.
codahale commentedon Jun 16, 2018
Actually, no — I can confirm w/ 2018.1.5/IU-181.5281.24 that it uses the Code Style settings and not google-java-format. This was always the problem I was experiencing, but perhaps I didn’t describe it well.
codahale commentedon Jun 16, 2018
To reproduce:
rymach commentedon Jul 30, 2018
I'm also seeing this issue (version 1.6.1 of the plugin)
alexbde commentedon Aug 6, 2018
We're also experiencing this issue. Is there any progress on this?
Reproducable on Windows 7 and macOS 10.13 with IntelliJ IDEA 2017.3, 2018.1 and 2018.2 using plugin 1.5.0 and 1.6.1.
Reformatting all code due to google/google-java-format#228
YanzheL commentedon Mar 31, 2019
Same issue with IntelliJ 2019.1 (IU-191.6183.87), google-java-format v1.7.0.1
Environment:
YanzheL commentedon Mar 31, 2019
It has been two years since this issue was posted, any progress?
mleonhard commentedon May 1, 2019
I really wish I could use the automatic formatter.
IntelliJ IDEA 2019.1.1 (Community Edition)
Build #IC-191.6707.61, built on April 16, 2019
JRE: 1.8.0_202-release-1483-b44 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.4
google-java-format v1.7.0.1
@plumpy Please fix? This issue and #264 are assigned to you and have been ignored for 2 years.
YanzheL commentedon May 1, 2019
My current workaround is to use XML based intellij-java-google-style file instead of this google-java-format plugin.
It works fine, but the formatted code is slightly different from the output of this plugin.
alexbde commentedon Jun 5, 2019
@YanzheL We're doing the same as workaround. We used plugin google-java-format for a while but not being able to use before commit action is confusing and frustrating our developers. This is a show stopper for us.
Last tested on
IntelliJ IDEA 2019.1.3 (Ultimate Edition)
Build #IU-191.7479.19, built on May 28, 2019
JRE: 1.8.0_202-release-1483-b58 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
krasa commentedon Oct 16, 2019
This should be just a matter of overriding
public void reformatTextWithContext(PsiFile psiFile, ChangedRangesInfo changedRangesInfo)denniseffing commentedon Jul 14, 2020
Are there any plans to support this in the future?
stonelazy commentedon Jul 20, 2020
Am having this exact same issue, any work arounds possible ? We face many merge conflicts due to this.
Tommy544 commentedon Nov 23, 2020
I am having the same issue, any update on this?
Agraphie commentedon Nov 27, 2020
Also observing the same issue. The workaround with the codestyle.xml is nice, but the formatting can be wildly different. Especially regarding annotations (on single line, annotation indentation, ...) so the workaround is in the end not really sufficient as you still have to always apply the style either manually or via a maven plugin.
Format code again using google code style. IntelliJ seems to have a p…
Format code again using google code style. IntelliJ seems to have a p…
vshamrai commentedon Feb 22, 2024
We faced the same issue. Can we expect that it will be fixed?