diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java index 0164d7e1a03..70cae30761a 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java @@ -2229,7 +2229,7 @@ public class CodeFormatterVisitor extends CPPASTVisitor { // initializer final IASTExpression newInitializer= node.getNewInitializer(); if (newInitializer != null || peekNextToken() == Token.tLPAREN) { - formatParenthesizedExpression(newInitializer); + formatFunctionCallArguments(newInitializer); } return PROCESS_SKIP; } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java index 81d7aec5042..8c3aeb2431e 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java @@ -721,4 +721,29 @@ public class CodeFormatterTest extends BaseUITestCase { assertFormatterResult(); } + //void f() { + // class Object; + // int aVeryLongParameterThatShouldBeInOneLine1; + // int aVeryLongParameterThatShouldBeInOneLine2; + // + // myNewFunctionCall1(Object(aVeryLongParameterThatShouldBeInOneLine1, aVeryLongParameterThatShouldBeInOneLine2)); + // + // myNewFunctionCall2(new Object(aVeryLongParameterThatShouldBeInOneLine1, aVeryLongParameterThatShouldBeInOneLine2)); + //} + + //void f() { + // class Object; + // int aVeryLongParameterThatShouldBeInOneLine1; + // int aVeryLongParameterThatShouldBeInOneLine2; + // + // myNewFunctionCall1(Object(aVeryLongParameterThatShouldBeInOneLine1, + // aVeryLongParameterThatShouldBeInOneLine2)); + // + // myNewFunctionCall2(new Object(aVeryLongParameterThatShouldBeInOneLine1, + // aVeryLongParameterThatShouldBeInOneLine2)); + //} + public void testLineWrappingOfConstructorCall_Bug237097() throws Exception { + assertFormatterResult(); + } + }