google-java-format icon indicating copy to clipboard operation
google-java-format copied to clipboard

Stop relying on IntelliJ internals

Open reda-alaoui opened this issue 3 years ago • 0 comments

As of today, it looks like there is no more need to "hack" CodeStyleManager.

With this change, the plugin does not override CodeStyleManager anymore neither relies on ComponentManagerImpl IntelliJ internal class. Instead, the plugin extends the FormatterService interface which is the official Jetbrains way of providing formatting features.

FormatterService opens up the ability to provide an ImportOptimizer. If this change gets merged, I will open another PR to add import reordering for #94 (commit ready at https://github.com/Cosium/google-java-format/commit/c11ef75d202f9ddbbc38bb6df63454acf2ba78e8 ).

I thought I found an issue explained at https://github.com/google/google-java-format/pull/820#issuecomment-1221522672 . But in the end, I think it was a false positive.

The current change is expected to retain the old behaviour without any "hack".

reda-alaoui avatar Aug 21 '22 11:08 reda-alaoui