Create import list psi element even if no directives are present

Fix a problem where deleting last import directive via "optimize imports" could lead to incorrect psi structure resulting in CCE, see EA-64291
New imports are inserted at the head (after package directive if present) of the file (before any comments) if no imports were present
Add test for inserting import to file where a first statement is a comment
Drop code dealing with non-existing import list in ImportInsertHelperImpl
AbstractQuickFixTest: check for unexpected actions before changes to the file are made as it relies on the first line having specific format
This commit is contained in:
Pavel V. Talanov
2015-06-08 15:13:33 +03:00
parent 4c4f730c53
commit 07d35d305e
461 changed files with 1275 additions and 472 deletions
@@ -6,6 +6,8 @@ JetFile: fragment.kt
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
IMPORT_LIST
<empty list>
PsiWhiteSpace('\n')
PROPERTY
PsiElement(val)('val')
@@ -15,4 +17,4 @@ JetFile: fragment.kt
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiElement(INTEGER_LITERAL)('1')