Is formatting changed in 1.9 or why is it adding a...
# getting-started
u
Is formatting changed in 1.9 or why is it adding a empty line before
else
in
when
?
v
Probably because your other branch is multi-line
u
what other branch
v
The one with the two
is
conditions
u
oh
okay you're right, my bad
but it's new regardless
okay not so fast 😄
no compoound condition
v
No, but still multi-line
u
thats a very odd rule
either new line them all, not just else - or none at all
v
🤷‍♂️
From https://kotlinlang.org/docs/coding-conventions.html#control-flow-statements:
In a
when
statement, if a branch is more than a single line, consider separating it from adjacent case blocks with a blank line:
u
fine. but the asymetricity of the whole thing is then just ugly ..if one is multiline then newline them all, regardless
okay thank you!
👌 1
v
Well, don't complain to me, but to the Kotlin team @ JetBrains. 🙂
😄 2
a
This is a bug. Even if you set min lines to 0, formatting forces it to 1 new line.
I don't know if this has already been reported on YouTrack
v
min != max
😄
And that setting is about when branches with braces, not about multi-line when branches
a
True, I misread. @ursus you could turn this off then:
🔥 2
u
btw how does changing the setting relate to the official formatting set by the
gradle.properties
? (
kotlin.code.style=official
)