introduce variable: don't duplicate comments (IDEA-195399)

This commit is contained in:
Anna.Kozlova
2018-07-12 13:41:20 +02:00
parent a74398fb40
commit f21f78af39
3 changed files with 2 additions and 5 deletions

View File

@@ -921,10 +921,6 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
declaration = addDeclaration(declaration, initializer);
LOG.assertTrue(expr1.isValid());
if (deleteSelf) {
final PsiElement lastChild = statement.getLastChild();
if (lastChild instanceof PsiComment) { // keep trailing comment
declaration.addBefore(lastChild, null);
}
CommentTracker commentTracker = new CommentTracker();
commentTracker.markUnchanged(initializer);
commentTracker.deleteAndRestoreComments(statement);

View File

@@ -10,5 +10,6 @@ class Main {
.toArray()//c-1
.toString();//c1
//c2
//c3
}
}

View File

@@ -11,6 +11,6 @@ class Main {
.toString()</selection>
//c1
//c2
;
;//c3
}
}