Fix for the formatting options combination of BreakBeforeBinaryOperators: All, AlignAfterOpenBracket: AlwaysBreak not handling long templates correctly. This patch allows a break after an opening left parenthesis, TemplateOpener, or bracket when both options are enabled.
Details
Diff Detail
Event Timeline
I think, this is the wrong fix. Instead, a
|| (Left.is(TT_TemplateOpener) && !Right.is(TT_TemplateCloser))
should be added to the last return statement of this function.
Also, could you please add a test in unittests/Format/FormatTest.cpp.
Trying that on my code after I finish rebasing and rebuilding, will also look into adding test to FormatTest.
Adds test case, changes to suggested fix allowing break after template opener that is not immediately followed by template closer.
Thanks. Are there additional steps I need to get it commited or do I just wait for a commiter to notice?
ping.
FYI I have found some additional similar cases when AlignConsecutiveDeclarations is also true, that I'll see if I can document/test case etc. at some point.
ping. I've been using this for a long time and still seems to apply to cleanly and works, though the line numbers have shifted a little since I generated the previous diff.