-
Notifications
You must be signed in to change notification settings - Fork 460
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
IntelliJ formatter #2020
base: main
Are you sure you want to change the base?
IntelliJ formatter #2020
Conversation
Thought of implementation plan, experimented with code dependencies using tests.
Added parameterized method to call idea formatter.
Used ForeignExe to check idea binary
IDEA running using gradle
IDEA running using maven
As described here: diffplug#200 (comment)
I'd also considered adding IDEA step into Kotlin extension. Or we could make it in the next PR. |
This part is lacking tests due to unpredictable nature of IDEA formatting. They may change configs thus breaking build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great start! It doesn't support up-to-date checking at all right now, and that would be fairly easy to add. I linked an example that does this correctly.
lib/src/main/java/com/diffplug/spotless/java/IdeaFormatterFunc.java
Outdated
Show resolved
Hide resolved
The results looks strange, build fails on CI but locally everything is fine 🤔 gradle plugin-gradle:spotlessJavaCheck |
I'd even consider adding this formatter to the generic |
I'm having a hard time testing this locally. I added https://www.jetbrains.com/help/idea/command-line-formatter.html#8feaa497 But I'm getting |
@nedtwigg I guess that's because of you running test from inside of IDEA. I myself using neovim so I obviously didn't face this problem. I guess this might be a blocker for those who use IDEA (almost everybody). Sorry, that I didn't thought gf this problem in advance, I should have had to. |
That seems to be a (very old!) bug in IntelliJ :( The listed workaround link no longer exists, but can be found on the web archive Maybe this helps? |
Opened a draft of the #200
Hope this looks fine!