lipiridi / spotless-applier

An IntelliJ plugin that allows running the spotless Gradle and Maven tasks from within the IDE, either on the current file selected in the editor or for the whole project.
MIT License
21 stars 2 forks source link

Doesn't replace wildcard imports when used together with `google-java-format` IntelliJ plugin #26

Closed Sax388 closed 1 month ago

Sax388 commented 1 month ago

I've read your comment https://github.com/diffplug/spotless/issues/649#issuecomment-1681075082 and thought that with these settings image the following would be replaced

import io.opentelemetry.instrumentation.annotations.*;

but unfortunately it stays after running the command.

I've restarted the IDE after installing the plugin. I'm using IntelliJ IDEA 2024.2.1 with the latest plugin version 1.1.2.

Sax388 commented 1 month ago

I've had a look at the code where you fetch the settings from the editor https://github.com/lipiridi/spotless-applier/blob/9ab38a4dc9ddcc6cddaffdda3cf34c44ec57cc31/src/main/java/com/github/lipiridi/spotless/applier/SynchronousOptimizeImportsProcessor.java#L44 so I double checked if the number of classes before falling back to * was high enough: image

And then I saw that you even use temporary settings to overwrite this. How cool. Integer max value is also so much better than my meager 999 😆 .

Sax388 commented 1 month ago

I found the culprit. When I switch off the google-java-format plugin image then it works like a charm. Thanks a million for this wonderful plugin!

lipiridi commented 1 month ago

Hello @Sax388! Sorry for the late response. I'm glad you solved the issue yourself! I guess google-java-format plugin somehow forcibly overrides the config. To be honest, I don't see the advantages to spent time resolving this,