Open llvmbot opened 9 years ago
The commit that introduced this issue is r235580 (clang-format: Support nested block formatting with ColumnLimit=0.)
Not setting BreakBeforeParameter to true if ColumnLimit is zero fixes the issue, but this commit explicitly introduced this change. I don't fully understand the logic behind the change. It seems that Tok->MustBreakBefore is always going to be true when encountering a "}]" at the end of a block inside of an Obj-C method call, which is going to always force a break before the parameter.
I can see this making sense if there's already a newline before the parameter with the block, but I don't think it should be always introducing newlines if the parameter isn't already on a separate line.
It seems there's something unusual happening here, too:
[self setupTextFieldSignals:@[ self.documentWidthField, self.documentHeightField, ] solver:^(NSTextField *textField) { return [self.representedObject solveEquationForTextField:textField]; }];
Gets reformatted to:
[self setupTextFieldSignals:@[
self.documentWidthField,
self.documentHeightField,
]
solver:^(NSTextField *textField) {
return [self.representedObject solveEquationForTextField:textField];
}];
Extended Description
Something has changed recently with regards to Objective-C formatting that's causing ColumnLimit of 0 to be ignored. I see this at the top level of my classes, but first noticed it inside blocks.
Expected output:
Actual output:
This is present in clang-format version 3.7.0 (http://llvm.org/git/clang.git f52c3d239ef95ff0ff71800258f879d661c261c5) (http://llvm.org/git/llvm.git 4bc9d4ea2648db800f0d89adc73bd43e91fc6dcf)