Closed ievgen-kapinos closed 2 weeks ago
Could you consider to add an option to fetch Ruleset version (
ktlint version
) from.editorconfig
file?
Please commit file .idea/ktlint-plugin.xml
to your version control. In this way, all preferences of the plugin will be shared amongst all developers on the project.
Need to try. Thank for the idea.
@paul-dingemans thank you for quick respond.
It works. Also I've discovered Idea's feature Required Plugins. So Idea IDE can notify user, if plugin is not installed.
Here what I end up with (notes for those who want to implement the same):
.gitignore
- configured manually
.idea/*
!.idea/externalDependencies.xml
!.idea/ktlint-plugin.xml
.idea/externalDependencies.xml
- configured via UI.
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalDependencies">
<plugin id="com.nbadal.ktlint" />
</component>
</project>
.idea/ktlint-plugin.xml
- configured via UI.
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KtLint plugin">
<ktlintMode>MANUAL</ktlintMode>
<ktlintRulesetVersion>V1_0_1</ktlintRulesetVersion>
</component>
</project>
Keep in mind, files in .idea
folder are not updated immediately (after click OK
or Apply
in Settings UI), but only after IDE quit.
Tnx for sharing back the required plugin settings which indeed might be helpful in cases like you describe. As you now have a working solution, I will close the issue.
Hi
On our projects my team uses
ktlint-intellij-plugin
(dev environment) and jlleitschuh/ktlint-gradle plugin (rarely on dev environment, always on CI/CD server).In this Gradle plugin we can set
ktlint version
as described here. That works well, because we can store it in repository and it will be applied automatically in all dev environments and CI/CD.As for
ktlint-intellij-plugin
I have to manually setktlint version
via IDE settings in each project. This problem becomes more painful when we have many developers using same project. Also, different projects may use differentktlint version
.Could you consider to add an option to fetch Ruleset version (
ktlint version
) from.editorconfig
file?I suppose it should be some new custom setting specifically prefixed for your plugin (like Idea has own settings with prefix
ij_
). So it can be stored in a repo and automatically applied in all dev environments wherektlint-intellij-plugin
is installed. If setting is not found, then default behaviour can be used. I suppose now your plugin by default uses some hardcodedktlint version
. In UI it appears asRuleset version: default (recommended)
.Something like this![Screenshot 2024-06-20 at 16 13 15](https://github.com/nbadal/ktlint-intellij-plugin/assets/3447597/b2c40777-e048-4cca-ab9f-c276908cc4e5)
P.S. It is clear that fetching
ktlint version
fromjlleitschuh/ktlint-gradle
plugin has no sense.