pinterest / ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
https://pinterest.github.io/ktlint/
MIT License
6.07k stars 504 forks source link

`no-multi-spaces` incompatible with IntelliJ's "align `when` branches" #2544

Closed mgroth0 closed 4 months ago

mgroth0 commented 5 months ago

We should be able to enable no-multi-spaces in a way that does not conflict with IntelliJ's KotlinCodeStyleSettings.ALIGN_IN_COLUMNS_CASE_BRANCH

Expected Behavior

Ability to have aligned when branches.

Current Behavior

no-multi-spaces removes aligned when branches.

Additional information

mgroth0 commented 5 months ago

Related to https://github.com/pinterest/ktlint/issues/2542. I created a new issue because these two requests can be implemented seperately, though they are related and 2542 would depend on this if both no-multi-spaces and the new rule were to be enabled together.

paul-dingemans commented 4 months ago

This will not be implemented. As documented in Kotlin Coding Conventions:

As a general rule, avoid horizontal alignment of any kind. Renaming an identifier to a name with a different length should not affect the formatting of either the declaration or any of the usages.