nbadal / ktlint-intellij-plugin

Ktlint plugin for IntelliJ IDEA + Android Studio
MIT License
158 stars 23 forks source link

Unintuitive behavior of "save action" checkbox #384

Closed Vampire closed 9 months ago

Vampire commented 9 months ago

When having ktlint 0.20.0-beta-4 enabled on a project and going to the "save actions", unchecking ktlint formatting there, it is disabled completely for the project. This for me is pretty unexpected / unintuitive.

If you can make the ktlint option not shown on the on-save actions, or maybe better disabled if possible so that is just shows the status, this might be better.

If this is not possible, maybe some message could be displayed that this will disable ktlint completely for the project?

paul-dingemans commented 9 months ago

When refactoring the plugin, I have removed the option to enable/disable formatting on save partly but did not refactor the on-save-actions dialog. I have reverted this behavior as I now can see the value of it. In all my personal/work projects, I have added ktlint to the build pipelines and in that case it does not make sense to disable format on save as it increases the risk that the build pipeline will fail at a later stage. But when using the plugin as an optional tool, it can make sense to disable it, so that formatting is only invoked whenever explicitly invoked.