IDEA-87087 Code formatting corrupts the code

Don't modify c-style comments white space
This commit is contained in:
Denis.Zhdanov
2012-08-01 09:51:54 +04:00
parent d3b1dfa49a
commit 93b64d5e31
3 changed files with 825 additions and 802 deletions
@@ -78,7 +78,10 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
}
if (myChild2 != null && StdTokenSets.COMMENT_BIT_SET.contains(myChild2.getElementType())) {
if (mySettings.KEEP_FIRST_COLUMN_COMMENT) {
if (myChild2.getElementType() == JavaTokenType.C_STYLE_COMMENT) {
myResult = Spacing.getReadOnlySpacing();
}
else if (mySettings.KEEP_FIRST_COLUMN_COMMENT) {
myResult = Spacing
.createKeepingFirstColumnSpacing(0, Integer.MAX_VALUE, true, mySettings.KEEP_BLANK_LINES_IN_CODE);
}
@@ -489,4 +489,18 @@ public class JavaFormatterIndentationTest extends AbstractJavaFormatterTest {
")"
);
}
public void testCStyleCommentIsNotMoved() throws Exception {
// IDEA-87087
doClassTest(
" /*\n" +
" this is a c-style comment\n" +
" */\n" +
" // This is a line comment",
" /*\n" +
" this is a c-style comment\n" +
" */\n" +
"// This is a line comment"
);
}
}
File diff suppressed because it is too large Load Diff