-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
google-java-format doesn't respect formatter:off #446
Comments
Hmmm.... Firstly I think the pairing you want it Secondly, these tags are supported by the eclipse formatter. However, I believe they are explicitly not supported by google-java-format: google/google-java-format#137 Before the google-java-format library existed, Google used the eclipse formatter with their own style file: https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml I don't know how the IntelliJ plugin works, but I bet you can get what you want like this: spotless {
java {
eclipse().configFile('eclipse-java-google-style.xml`) |
As an avid google-java-format user myself, I can confirm that google-java-format indeed doesn't support the @nedtwigg's workaround looks very sensible to me, so that's what I'd recommend if you want to use those tags. As for the IntelliJ google-java-format plugin, I suspect the reason why it recognises the tags is because it partially delegates to IntelliJ's default formatter, which recognises the tags by default. But I don't have a computer with IntelliJ in front of me, so I'd have to confirm that some other time. I hope our responses have answered your question, and if you still need help, please feel free to follow up. :) |
Thanks everybody, I'm going to apply the @nedtwigg suggestion that seems powerful and pretty customizable. |
@nedtwigg sorry for my english :) |
Just an update that since |
In my team we like builders and Fluent API's keep in several lines. Apparently, Google Java Format inline these lines, but we use to apply comments to don't format that specific lines. For example:
If we apply Intellij Google Java Format plugin, ignore this line (the expected behavior), but Spotless Gradle plugin ignore this comments. Result:
How we can configure to ignore this sections?
The text was updated successfully, but these errors were encountered: