mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Bug 561559 - Fix formatting def capture lambda expressions
We missed a space before the closing brackets if the proper option was selected. Change-Id: Ibbb09c3c961dc1b5e22aaa65ffb5d9878c2bb08b
This commit is contained in:
parent
f4951d8086
commit
f20570a200
2 changed files with 22 additions and 2 deletions
|
@ -2492,7 +2492,8 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
|
||||
final int elementsLength = elements.size();
|
||||
if (encloseInParen) {
|
||||
boolean spaceBeforeClosingParen = elements.isEmpty() && !addEllipsis ? options.fSpaceBetweenEmptyParen
|
||||
boolean spaceBeforeClosingParen = elements.isEmpty() && !addEllipsis
|
||||
&& options.captureDefault == CaptureDefault.UNSPECIFIED ? options.fSpaceBetweenEmptyParen
|
||||
: options.fSpaceBeforeClosingParen;
|
||||
tailFormatter = new ClosingParensesisTailFormatter(spaceBeforeClosingParen, tailFormatter,
|
||||
options.rightToken);
|
||||
|
|
|
@ -4734,4 +4734,23 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
public void testFormatterOnOff_Bug559669() throws Exception {
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
||||
//int main() {
|
||||
// auto f = [&](){
|
||||
// };
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
//int main() {
|
||||
// auto f = [ & ]() {
|
||||
// };
|
||||
// return 0;
|
||||
//}
|
||||
public void testLambdaExpressionOnlyDefCapture_Bug561559() throws Exception {
|
||||
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION,
|
||||
CCorePlugin.INSERT);
|
||||
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION,
|
||||
CCorePlugin.INSERT);
|
||||
assertFormatterResult();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue