-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add support for multiple/runtime-specific versions of ktlint #35
Comments
Here is copy of my editorconfig (uploading as txt because github doesn't want to accept Linux hidden file attachment): |
Here are some more IntelliJ configs (uploading as txt because github doesn't want to accept xml attachment): |
Thanks for flagging this and for the sample files! I'll take a look today 😄 |
@IvanPizhenko is it possible this is caused by #28 ? The workaround / way to test this would be to explicitly set the folder for your I wasn't able to reproduce that ktlint error with a short example, but that message comes from the |
@nbadal Yes, I've faced #28, but I've configured explicit path to the editorconfig, you can see |
I will try to make it reproduced in a small sample project. |
Here is sample project https://github.com/IvanPizhenko/kotlin-sample-project |
Look here https://github.com/IvanPizhenko/kotlin-sample-project/blob/bb95c355aa5e78af4b2744b0d70fb080bc5c2282/module1/src/main/kotlin/org/example/Controller.kt#L15 |
Awesome, thank you! I'll make sure to distill this down into a test case as well once I've got that set up 😁 Looking into it now, then I'll publish a fix in 0.7.1 hopefully 🤞 |
I think this may be due to the gradle ktlint plugin using ktlint 0.39.0, and my plugin using 0.40.0 – I'll have to verify this tomorrow morning, but using This might be fixed by pinterest/ktlint#901 ? Seems like a relevant entry in the 0.40.0 changelog |
That would be a nice feature – albeit a bit trickier to implement within the confines of the IDE plugin, but it might be possible! I'll add it to the roadmap 😄 |
@nbadal If you wouldn't mind, I could try finding some spare time to develop this feature and contribute to the plugin? I don't want to step on anyone else's toes if someone is already on it! |
@alexfacciorusso absolutely, take a stab at it! |
I'm also interested in this feature. Until then, this plugin is probably not very UX friendly for me. I specifically use https://github.com/JLLeitschuh/ktlint-gradle to simply run ktlint as Gradle tasks (e.g. Wishful thinking: have your plugin detect the Gradle plugin and use its executable, even if it later updates to a newer version. |
Any chance to have it in the nearest next version? |
I haven't heard any progress from @alexfacciorusso - I can start to take a look at this again |
Lol I read this and got a smile since I'm in the same boat. I maintain a different IntelliJ plugin that uses Kotlin and I use the same @nbadal Could you point me to the class(es) I should look at which determine the version of ktlint that's downloaded? I've done plugin and UI work with IntelliJ's platform before so I could try poking around to see if I can make a custom version box of some kind work. |
I have had a look at how this is done in |
Next version of plugin supports ktlint versions 0.50.0, 1.0.1, 1.1.1 and 1.2.1. |
* Support multiple versions of ktlint standard ruleset The StandardRulesetProvider from each supported version of ktlint is transformed with shadow plugin to a unique class so that multiple versions of the StandardRulesetProvider class can be compiled into the plugin. Closes #426 Closes #35 * Increase build memory (cherry picked from commit 516955b)
This feature will be postponed. Current solution has unwanted side effect that size of plugin increases with 64MB per version of ktlint rules included. See #498. |
* Support multiple versions of ktlint standard ruleset The StandardRulesetProvider from each supported version of ktlint is transformed with shadow plugin to a unique class so that multiple versions of the StandardRulesetProvider class can be compiled into the plugin. Closes #426 Closes #35 * Increase build memory (cherry picked from commit 516955b)
I have a code like this:
IDE with installed ktlint plugin is happy with this code, i.e. doesn't put red marks.
But when I run my Gradle build, ktlint check compains at the same code:
I'm expecting that should plugin also detect this inconsistency, but actually it is not.
The text was updated successfully, but these errors were encountered: