Open sureyeaah opened 4 years ago
@sureyeaah I don't remember if this behavior is intentional or not, but I agree that it doesn't make any sense.
If you want to fix this when working on https://github.com/cdepillabout/pretty-simple/issues/25, please feel free.
The 'expected behaviour' here is actually precisely what you get with pPrintStringOpt (defaultOutputOptionsDarkBg {outputOptionsIndentAmount = 2})
.
As for how leading commas and four space indentation should interact, I've been pondering that while working on Fourmolu, where the status quo is close to your expected output, but that actually leads to a weird mix of two- and four-space indentation that I'm not happy with. So the current pretty-simple
output is close to what I'm intending to implement there... What don't you like about it?
Well what i don't like about the current behaviour as described in the issue is that it makes no sense. Why are the first element's paranthesis indented with 4 spaces while third with 2 - doesn't seem right.
If the expected behaviour is what pretty simple produces then this is resolved.
Why are the first element's parantheses indented with 4 spaces while third with 2 - doesn't seem right.
Because in a sense the third subexpression isn't really indented at all. Regardless of the indentation step, there's just the one space after the comma.
You could have this, but I think it looks weird:
(
( 1
, 2
)
, 3
, ( 4 )
)
I think if you care about those lining up, you have to just use 2 space indentation. I've never seen a good solution with 4.
Reproduce:
Current behavior
Expected behavior: First tuple should be aligned with the rest of the elements.
Is the current behavior intentional?