palantir / palantir-java-format

A modern, lambda-friendly, 120 character Java formatter.
Apache License 2.0
469 stars 48 forks source link

[IntelliJ] Add note on Imports #954

Open koppor opened 12 months ago

koppor commented 12 months ago

What happened?

I have activated palantir java format:

image

This does not change the code style configured in the IDE:

image

When executing "optimize imports", the configured style is followed.

What did you want to happen?

When executing "optimize imports", the palantir-style is followed


General wishes:

jrchen-amzn commented 9 months ago

I'm experiencing similar issues...

I'm curious whether the IntelliJ IDEA plugin could additionally optimize imports while reformatting code now?

okuzan commented 9 months ago

Any updates on this? Would be nice to not only format the code, but imports too, if IDEA supports this itself

yotamshtosselfg commented 6 months ago

This is a nasty one. We turned off Intellij's "auto optimize imports" on-the-fly / on save.

Seems like Intellij is going above and beyond the call of duty and trying to reformat on optimize imports: https://youtrack.jetbrains.com/issue/IDEA-353203/Intellij-optimize-imports-action-changes-formatting-of-text-blocks

mindhaq commented 4 months ago

We turned off Intellij's "auto optimize imports" on-the-fly / on save.

This is not helping me; first palantir reformats, then the imports are re-ordered, and spotless complains that the formatting is not correct.

koppor commented 4 months ago

This is not helping me; first palantir reformats, then the imports are re-ordered, and spotless complains that the formatting is not correct.

I don't get the comment. On https://github.com/palantir/palantir-java-format/issues/954#issuecomment-2108761245 it is said that "Optimize imports" is off. At your side, it is off, too, but there is still a change by IntelliJ?

@mindhaq Could you double check our "Optimize imports" setting?

image