-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After linebreaks following =
, indentation is off
#39
Comments
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 y = if x
1
else
2
end is pretty common. The style you have with a line break before the 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 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
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. Also, my understanding is that Runic is supposed to leave linebreaks intact; if you prefer |
This patch reworks the indentation after assignment. For "blocklike" (try/if/triple strings) right hand sides the indentation is disabled. Superfluous newlines are removed. For example ```julia x = if a x else y end ``` will become ```julia x = if a x else y end ``` A valid alternative is ```julia x = if a x else y end ``` This highlights the start/end of the right hand side of the assignment in a better way, but it doesn't look very nice and this style is never really seen in the wild. For triple strings I think it is OK though, e.g. ```julia x = """ foo bar """ ``` vs the current (and seen more in the wild) ```julia x = """ foo bar """ ``` Closes #39.
This patch reworks the indentation after assignment. For "blocklike" (try/if/triple strings) right hand sides the indentation is disabled. Superfluous newlines are removed. For example ```julia x = if a x else y end ``` will become ```julia x = if a x else y end ``` A valid alternative is ```julia x = if a x else y end ``` This highlights the start/end of the right hand side of the assignment in a better way, but it doesn't look very nice and this style is never really seen in the wild. For triple strings I think it is OK though, e.g. ```julia x = """ foo bar """ ``` vs the current (and seen more in the wild) ```julia x = """ foo bar """ ``` Closes #39.
See #42. |
This patch reworks the indentation after assignment. For "blocklike" (try/if/triple-strings) right hand sides the indentation is disabled. Closes #39.
For example, Runic reformats
to
which is likely not intended.
(This also applies to short-form function definitions with linebreaks after the
=
.)The text was updated successfully, but these errors were encountered: