-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Adds multiline formatting for array
#2593
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- How come a tuple is being tested in an array PR?
- Should there be another test for
[ some, args, here, ...,
and, more,
here ]
and a few variations of that?
I can add it in another PR, they're both collections and use generally the same logic so I added it while testing to be sure they both functioned |
@Braqzen I'm not sure I understand the second part, if you'd like I can add an explicit example though! Currently we have either normal formatting [some, thing, here, ...] and once it reaches a threshold it gets vertical formatting [
some,
thing,
here,
...,
] |
What will the formatter do if it is presented with the input that I have added in the code block? |
So, since this is an AST based formatter, it takes the actual items into account but not the white space. You can think of it like this, your example: [ some, args, here, ...,
and, more,
here ] gets collected, which you could represent like: [Collection(Var("some"), Var("args"), Var("here"), Var("..."), Var("and"), Var("more"), Var("here"))] it does not take into account any whitespace, the formatter strips that by design and we inject whitespace and newlines situationally [some, args, here, ..., and, more, here] |
That sounds really cool. Thanks for letting me know! |
Closes #726
Ref #2493