mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java create local from usage: do not duplicate comments inside variable initializer (IDEA-256107)
GitOrigin-RevId: 3f9298e0d38ca0840a57922a7b9eb23c27277668
This commit is contained in:
committed by
intellij-monorepo-bot
parent
91029bab3c
commit
3a646d1f0c
+3
-1
@@ -110,7 +110,9 @@ public class CreateLocalFromUsageFix extends CreateVarFromUsageFix {
|
||||
TypeExpression expression = new TypeExpression(project, expectedTypes);
|
||||
|
||||
if (isInline) {
|
||||
decl = (PsiDeclarationStatement)new CommentTracker().replaceAndRestoreComments(anchor, decl);
|
||||
CommentTracker tracker = new CommentTracker();
|
||||
tracker.markUnchanged(initializer);
|
||||
decl = (PsiDeclarationStatement)tracker.replaceAndRestoreComments(anchor, decl);
|
||||
}
|
||||
else {
|
||||
decl = (PsiDeclarationStatement)anchor.getParent().addBefore(decl, anchor);
|
||||
|
||||
+2
-1
@@ -3,7 +3,8 @@ public class A {
|
||||
void foo() {
|
||||
String[] split = null;
|
||||
//c1
|
||||
String zeit = split[1]; // 2011-04-13
|
||||
String zeit = split//c2
|
||||
[1]; // 2011-04-13
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,7 +3,8 @@ public class A {
|
||||
void foo() {
|
||||
String[] split = null;
|
||||
ze<caret>it//c1
|
||||
= split[1]; // 2011-04-13
|
||||
= split//c2
|
||||
[1]; // 2011-04-13
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user