diff options
author | Sergey Prigogin | 2011-10-04 23:30:12 +0000 |
---|---|---|
committer | Sergey Prigogin | 2011-10-04 23:30:12 +0000 |
commit | 3edce39739a91463835411e629001eef02d75ebf (patch) | |
tree | 3a5f2b76ef7fb412892d9b42edb5d0ec329e84b8 | |
parent | 242b783c8c4d32d13409ce099c72126ec7d24648 (diff) | |
download | org.eclipse.cdt-3edce39739a91463835411e629001eef02d75ebf.tar.gz org.eclipse.cdt-3edce39739a91463835411e629001eef02d75ebf.tar.xz org.eclipse.cdt-3edce39739a91463835411e629001eef02d75ebf.zip |
Bug 359905 - Invalid formatting of comment in enum.
-rw-r--r-- | core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java | 1 | ||||
-rw-r--r-- | core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java | 22 |
2 files changed, 23 insertions, 0 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 2368c0aee5c..b4626fc404e 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 @@ -2032,6 +2032,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor, scribe.space(); } } + scribe.printTrailingComment(); if (enumIndent > braceIndent) { scribe.unIndent(); 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 989fa1fac6c..ef9692b2095 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 @@ -2736,4 +2736,26 @@ public class CodeFormatterTest extends BaseUITestCase { assertFormatterResult(); } + //enum SomeEnum { + //FirstValue,// first value comment + //SecondValue// second value comment + //}; + //enum OtherEnum { + //First,// first value comment + //Second,// second value comment + //}; + + //enum SomeEnum { + // FirstValue, // first value comment + // SecondValue // second value comment + //}; + //enum OtherEnum { + // First, // first value comment + // Second, // second value comment + //}; + public void testEnum() throws Exception { + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE); + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_MIN_DISTANCE_BETWEEN_CODE_AND_LINE_COMMENT, "2"); + assertFormatterResult(); + } } |