Skip to content
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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

IntelliJ formatter #2020

wants to merge 17 commits into from

Conversation

IlyasYOY
Copy link

@IlyasYOY IlyasYOY commented Jan 23, 2024

Opened a draft of the #200

Hope this looks fine!

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
@IlyasYOY
Copy link
Author

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.
Copy link
Member

@nedtwigg nedtwigg left a 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.

CHANGES.md Show resolved Hide resolved
@IlyasYOY IlyasYOY marked this pull request as ready for review January 27, 2024 11:45
@IlyasYOY IlyasYOY requested a review from nedtwigg January 27, 2024 11:46
@IlyasYOY
Copy link
Author

The results looks strange, build fails on CI but locally everything is fine 🤔

gradle plugin-gradle:spotlessJavaCheck

@simschla
Copy link
Contributor

simschla commented Feb 7, 2024

I'd also considered adding IDEA step into Kotlin extension.

Or we could make it in the next PR.

I'd even consider adding this formatter to the generic FormatExtension as IntelliJ IDEA can format countless languages and is not restricted to Java and/or Kotlin. (Unless @nedtwigg has objections)

@nedtwigg
Copy link
Member

I'm having a hard time testing this locally. I added idea to my path which was tricky, tried to follow these

https://www.jetbrains.com/help/idea/command-line-formatter.html#8feaa497

But I'm getting Only one instance of IDEA can be run at a time.

@IlyasYOY
Copy link
Author

I'm having a hard time testing this locally. I added idea to my path which was tricky, tried to follow these

https://www.jetbrains.com/help/idea/command-line-formatter.html#8feaa497

But I'm getting Only one instance of IDEA can be run at a time.

@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.

@simschla
Copy link
Contributor

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?

@diffplug diffplug deleted a comment from one-harsh Oct 2, 2024
@diffplug diffplug deleted a comment from fokkoru Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants