Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2011-09-21 12:28:09 +0000
committerAnton Leherbauer2011-09-21 12:46:39 +0000
commit5c47f3f1a1317b4deac1407f7dac5b0de4d057f9 (patch)
treefdad63a1cd7b7e3a11100f9aceee630bba0a885b
parente2aef245cdc7dd73235d035ba5b18ee41496ef1e (diff)
downloadorg.eclipse.cdt-5c47f3f1a1317b4deac1407f7dac5b0de4d057f9.tar.gz
org.eclipse.cdt-5c47f3f1a1317b4deac1407f7dac5b0de4d057f9.tar.xz
org.eclipse.cdt-5c47f3f1a1317b4deac1407f7dac5b0de4d057f9.zip
Bug 357300 - Function parameter line wrapping wraps commas separating parameters
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java14
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java8
2 files changed, 14 insertions, 8 deletions
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 8cc1eb756e..553f2c6b5e 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
@@ -2089,14 +2089,6 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
int i;
for (i = 0; i < elementsLength; i++) {
final IASTNode node= elements.get(i);
- if (i < elementsLength - 1) {
- scribe.setTailFormatter(
- new TrailingTokenFormatter(options.fSeparatorToken,
- options.fSpaceBeforeSeparator,
- options.fSpaceAfterSeparator));
- } else {
- scribe.setTailFormatter(tailFormatter);
- }
scribe.alignFragment(alignment, i);
if (node instanceof ICPPASTConstructorChainInitializer) {
// Constructor chain initializer is a special case.
@@ -2105,7 +2097,13 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
node.accept(this);
}
if (i < elementsLength - 1) {
+ scribe.setTailFormatter(
+ new TrailingTokenFormatter(options.fSeparatorToken,
+ options.fSpaceBeforeSeparator,
+ options.fSpaceAfterSeparator));
scribe.runTailFormatter();
+ } else {
+ scribe.setTailFormatter(tailFormatter);
}
}
if (addEllipsis) {
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 35feb483ca..16b944194e 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
@@ -2688,4 +2688,12 @@ public class CodeFormatterTest extends BaseUITestCase {
assertFormatterResult();
}
+ //void wrap_when_necessary(more_than_one_template_argument_t<int, float> p1, no_template_arguments_t p2, no_template_arguments_t p3) {}
+
+ //void wrap_when_necessary(more_than_one_template_argument_t<int, float> p1,
+ // no_template_arguments_t p2, no_template_arguments_t p3) {
+ //}
+ public void testTemplateIdInParameterList_Bug357300() throws Exception {
+ assertFormatterResult();
+ }
}

Back to the top