Closed lmshk closed 3 weeks ago
Given the existing rules I would have guessed the result would be
y = if x
1
else
2
end
but that doesn't look very good either. Probably proper blocks like if-end
should have some more "inertia" for changes like this because code like
y = if x
1
else
2
end
is pretty common. The style you have with a line break before the if
I haven't seen much actually. Would you expect
y =
if x
1
else
2
end
?
I would expect my original form, because the expression as continued on the second line is just indented once. (I usually do this if ?
/:
does not fit on the first line.)
I'd be fine with your second example as well. (If I write it like that, Runic leaves it as it is.)
I think it should be
y = if x
1
else
2
end
the other options present look off to me (including the original example, no offense intended @lmshk 😅)
That implies that for long conditions, breaking the line then would indent the continuation at the same level as the body. (Similarly for short-form function definitions).
Also, my understanding is that Runic is supposed to leave linebreaks intact; if you prefer y = if x
, you can already write it like that and it will not be broken up.
See #42.
For example, Runic reformats
to
which is likely not intended.
(This also applies to short-form function definitions with linebreaks after the
=
.)