mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
split into declarations: preserve comments in normalizeDeclaration
This commit is contained in:
+3
-1
@@ -181,7 +181,9 @@ public class PsiLocalVariableImpl extends CompositePsiElement implements PsiLoca
|
||||
|
||||
ASTNode comma = PsiImplUtil.skipWhitespaceAndCommentsBack(variable.getTreePrev());
|
||||
if (comma != null && comma.getElementType() == JavaTokenType.COMMA) {
|
||||
CodeEditUtil.removeChildren(statement, comma, variable.getTreePrev());
|
||||
PsiElement commaPsi = comma.getPsi();
|
||||
PsiElement lastWhitespaceAfterComma = commaPsi != null && commaPsi.getNextSibling() instanceof PsiWhiteSpace ? PsiTreeUtil.skipWhitespacesForward(commaPsi) : null;
|
||||
CodeEditUtil.removeChildren(statement, comma, lastWhitespaceAfterComma != null ? lastWhitespaceAfterComma.getNode() : comma);
|
||||
}
|
||||
|
||||
CodeEditUtil.removeChild(statement, variable);
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Split into separate declarations" "true"
|
||||
class Test {
|
||||
{
|
||||
String foo = "foo";//c1
|
||||
//c2
|
||||
String bar = "bar";
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Split into separate declarations" "true"
|
||||
class Test {
|
||||
{
|
||||
String foo <caret>= "foo",//c1
|
||||
bar = "bar";//c2
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user