mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
add field to enum: ensure correct position after comment (IDEA-131820)
This commit is contained in:
@@ -26,6 +26,7 @@ import com.intellij.psi.impl.source.tree.*;
|
||||
import com.intellij.psi.tree.ChildRoleBase;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.CharTable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -111,6 +112,9 @@ public class ClassElement extends CompositeElement implements Constants {
|
||||
for (ASTNode run = anchor; run != null; run = run.getTreeNext()) {
|
||||
if (run == semicolonPlace) {
|
||||
anchor = before.booleanValue() ? semicolonPlace.getTreeNext() : semicolonPlace;
|
||||
if (anchor != null && PsiImplUtil.isWhitespaceOrComment(anchor)) {
|
||||
anchor = PsiTreeUtil.skipSiblingsForward(anchor.getPsi(), PsiWhiteSpace.class, PsiComment.class).getNode();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Create Field for Parameter 'p1'" "true"
|
||||
|
||||
enum Test{
|
||||
A;//comment
|
||||
|
||||
private int myP1;
|
||||
|
||||
void f(int p1){
|
||||
myP1 = p1;
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create Field for Parameter 'p1'" "true"
|
||||
|
||||
enum Test{
|
||||
A;//comment
|
||||
|
||||
void f(int p<caret>1){
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user