You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a few projects that use this plugin to format our code before commit.
We also use the Ktlint IntelliJ plugin with auto formatting to fix code violations on-save before commit.
Problem
Currently, the rules applied by that plugin don't align with the rules applied by this plugin.
I'd like to make the IDE plugin use the rules in use by this plugin.
Environment
ktlint-gradle version 11.6.1
Android Studio 2023.1.1
Android Studio ktlint plugin (According to the docs, the plugin currently runs with ktlint version 1.1.0 and can use .editorconfig)
What I've tried
I've tried to use the ktlintApplyToIdea to export the rules and apply them to the IDE, but I'm receiving
> Task :ktlintApplyToIdea
Skipping ktlintApplyToIdea. The applyToIDEA functionality was removed from ktlint in 0.47.0. Use .editorconfig to synchronize formatting rules between IDEA and ktlint.
BUILD SUCCESSFUL in 219ms
1 actionable task: 1 executed
Because I don't know the default rules, I don't have the information required to Use .editorconfig to synchronize formatting rules between IDEA and ktlint..
Request
Is there some documentation on how I can export an xml ruleset, or guidance on this?
The text was updated successfully, but these errors were encountered:
wejrox
changed the title
Setting up IntelliJ rules to match the plugin
Using this plugin with the official IntelliJ IDE plugin
Jan 22, 2024
the code style used by default is whichever the underlying version of ktlint is using. So for ktlint version < 1 it is intellij style, and for >=1 it is ktlint_official.
as for the configuration of specfic rules, again, this is tied to the version of ktlint being used.
since you are using ktlint-gradle 11.6.1, the version of ktlint it is using by default is 0.47.1. I recommend changing this to match the version of ktlint your intellij plugin is using.
Summary
I've got a few projects that use this plugin to format our code before commit.
We also use the Ktlint IntelliJ plugin with auto formatting to fix code violations on-save before commit.
Problem
Currently, the rules applied by that plugin don't align with the rules applied by this plugin.
I'd like to make the IDE plugin use the rules in use by this plugin.
Environment
ktlint-gradle version
11.6.1
Android Studio
2023.1.1
Android Studio ktlint plugin (According to the docs, the plugin currently runs with ktlint version 1.1.0 and can use
.editorconfig
)What I've tried
I've tried to use the
ktlintApplyToIdea
to export the rules and apply them to the IDE, but I'm receivingBecause I don't know the default rules, I don't have the information required to
Use .editorconfig to synchronize formatting rules between IDEA and ktlint.
.Request
Is there some documentation on how I can export an xml ruleset, or guidance on this?
The text was updated successfully, but these errors were encountered: