You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the report! In general, when a function f is applied to an argument x in multi-line layout, we indent x by one more step than f (that's where the impression that there are 4 spaces of indentation comes from):
test =
f
x
In your suggested formatting output however
f =
( a
( b
c
)
)
functions and their arguments are on the same level of indentation, i.e.
test =
f
x
which seems a bit unexpected.
A variant of formatting multi-line code in parentheses is given in #891, seems related to this issue.
I'm following how we ended up where we are, and it matches what you're describing. It's not what I'd expect however, so I'm wondering what my mental rule is. Perhaps "the first non-space character on each line is what the indentation level is"? #891 comes to the same conclusion, but for different reasons.
I'd expect this formatting, just like you:
test =
f
x
but also this:
test =
(f
x
)
or possibly this, but the f-x alignment feels wrong:
test =
( f
x
)
I guess that unwanted f-x function-argument alignment why elm-format doesn't add a space between ( and f. I too expect function arguments to be indented further than the function they're applied to.
Describe the bug
I get what I percieve as 4-space indentation whenever I have many nested parentheses. I'd like 2-space indentation here as well.
To Reproduce
gives
Expected behavior
Environment
0.7.7.0 and https://ormolu-live.tweag.io/
Additional context
I guess ormolu thinks that the parenthesis is one indentation, and the inner function call is another, so 2+2 space indentation?
FWIW, elm-format (which uses 4-space indentation) handles this close to what I'd expect:
(modulo space after paren)
The text was updated successfully, but these errors were encountered: