-
Notifications
You must be signed in to change notification settings - Fork 57
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
Introduce semi-expanded format for all containers #309
Conversation
LastFitsFun = last_fits_fun(LastFits, Values), | ||
BreakKind = break_behaviour(Meta, Values, BreakKind0), | ||
BreakFun = break_fun(BreakKind), | ||
BreakBehaviour = break_behaviour(Meta, Values, BreakKind), |
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.
Nice naming
@@ -535,16 +527,14 @@ has_opening_line_break(Meta, [HeadValue | _]) -> | |||
|
|||
has_any_break_between([Head | [Head2 | _] = Tail]) -> | |||
has_break_between(Head, Head2) orelse has_any_break_between(Tail); | |||
has_any_break_between([{cons, _, Head, Tail}]) -> |
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.
Ah I see this is for the new case you brought up
group(concat(nest(concat(Left, Doc), ?INDENT, break), Right)). | ||
group(concat(nest(concat(Left, Doc), ?INDENT, break), Right)); | ||
surround_container(#break{inner = ForceInner, outer = ForceOuter}, Left, Doc, Right) -> | ||
InnerDoc = group(concat(maybe_force_breaks(ForceInner), Doc)), |
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.
So Doc is now always grouped, does this still cover the line
case, which was not grouped?
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.
Yes, using force_breaks()
turns break()
into line()
so that still works correctly and removes one case
), | ||
?assertSame( | ||
"-export([\n" | ||
" bar/1, baz/1\n" |
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.
Oh interesting.
I guess this is now a thing.
Almost feel like export should be special cased, but it is probably fine.
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.
Yes, I thought about this as well, but it seems consistent, if everything fits on a single line
"-export([\n" | ||
" foo/1,\n" | ||
" bar/1,\n" | ||
" baz/1, baz/2\n" |
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.
Great test
15526cd
to
6b2ac75
Compare
This change implements the semi-expanded format introduced for function calls in #305 to all the containers.