mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Hopefuly last empty import list placement issue
This commit is contained in:
@@ -96,10 +96,17 @@ public class ParseUtil extends ParseUtilBase {
|
||||
if (anImport == null || !isEmptyImportList(anImport)) return;
|
||||
|
||||
final TreeElement next = (TreeElement)TreeUtil.skipElements(anImport.getTreeNext(), ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET);
|
||||
if (next != null && next != anImport) {
|
||||
if (next != null) {
|
||||
anImport.rawRemove();
|
||||
next.rawInsertBeforeMe(anImport);
|
||||
}
|
||||
else {
|
||||
final TreeElement last = (TreeElement)root.getLastChildNode();
|
||||
if (last != null && last != anImport) {
|
||||
anImport.rawRemove();
|
||||
last.rawInsertAfterMe(anImport);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void bindComments(ASTNode root) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// unclosed comment
|
||||
/*
|
||||
|
||||
import java.io.*;
|
||||
|
||||
class a {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
PsiJavaFile:UnclosedComment.java
|
||||
PsiComment(END_OF_LINE_COMMENT)('// unclosed comment')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiComment(C_STYLE_COMMENT)('/*\n\nimport java.io.*;\n\nclass a {\n}')
|
||||
PsiImportList
|
||||
<empty list>
|
||||
@@ -24,4 +24,5 @@ public class CommonJavaParsingTest extends JavaParsingTestCase{
|
||||
public void testIncompleteCodeBlock() { doTest(true); }
|
||||
public void testImportListBug() { doTest(true); }
|
||||
public void testRefParamsAfterError() { doTest(true); }
|
||||
public void testUnclosedComment() { doTest(true); } // todo: fix
|
||||
}
|
||||
Reference in New Issue
Block a user