Regarding `multiline-expression-wrapping` rule: Wh...
# ktlint
d
Regarding
multiline-expression-wrapping
rule: Why is the code formatted differently based one whether the expression is assigned to a variable or to a function argument? This looks a little bit inconsistent to me.
p
The code sample on the right, is not the way it is formatted for me. That one should be indented as well (at least in code style
ktlint_official
). So it might be related to your configuration. Can you provide your
.editorconfig
and the code sample (not as image)?
d
Yes, this happens only of the code style is intellij_idea. So perhaps it's actually a different rule causing the (mis)alignment?
p
No, the code on the right is the default formatting of Intellij IDEA. It is actually one of the reasongs why
ktlint_official
code style was created.
d
Ok, so perhaps there's just a minor mistake in the docs. It says that the
indent
rule (which should be responsible for this) has the same settings in both
intellij_idea
and
ktlint_official
styles. In reality the formatting is different in those two cases.
p
That is correct. There are differences between the two code styles in the
indent
rule. Those are not configurable though.
d
So should those differences perhaps be mentioned in the doc?
p
It is almost impossible to document every edge case in the documentation without writing an entire book. That is why the documentation of this rule also refers to the unit tests. The unit tests for the indent rule is currently 5500+ LOC...
👍 1