mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
create local from usage: do not remove tailing comment (IDEA-69372)
This commit is contained in:
@@ -89,6 +89,14 @@ public class CreateLocalFromUsageFix extends CreateVarFromUsageFix {
|
||||
TypeExpression expression = new TypeExpression(project, expectedTypes);
|
||||
|
||||
if (isInline) {
|
||||
final PsiExpression expr = ((PsiExpressionStatement)anchor).getExpression();
|
||||
final PsiElement semicolon = expr.getNextSibling();
|
||||
if (semicolon != null) {
|
||||
final PsiElement nextSibling = semicolon.getNextSibling();
|
||||
if (nextSibling != null) {
|
||||
decl.addRange(nextSibling, anchor.getLastChild());
|
||||
}
|
||||
}
|
||||
decl = (PsiDeclarationStatement)anchor.replace(decl);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create Local Variable 'zeit'" "true"
|
||||
public class A {
|
||||
void foo() {
|
||||
String[] split = null;
|
||||
String zeit = split[1]; // 2011-04-13
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create Local Variable 'zeit'" "true"
|
||||
public class A {
|
||||
void foo() {
|
||||
String[] split = null;
|
||||
String zeit<caret> = split[1];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create Local Variable 'zeit'" "true"
|
||||
public class A {
|
||||
void foo() {
|
||||
String[] split = null;
|
||||
ze<caret>it = split[1]; // 2011-04-13
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create Local Variable 'zeit'" "true"
|
||||
public class A {
|
||||
void foo() {
|
||||
String[] split = null;
|
||||
ze<caret>it = split[1]
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user