Do not fold imports if there is only one

#KT-3410 Fixed
This commit is contained in:
Natalia.Ukhorskaya
2013-04-02 17:25:02 +04:00
parent 0985b124df
commit d84cf971c1
3 changed files with 9 additions and 1 deletions
@@ -45,7 +45,7 @@ public class JetFoldingBuilder extends FoldingBuilderEx implements DumbAware {
JetFile file = (JetFile) root;
List<JetImportDirective> importList = file.getImportDirectives();
if (importList != null && !importList.isEmpty()) {
if (importList != null && importList.size() > 1) {
JetImportDirective firstImport = importList.get(0);
PsiElement importKeyword = firstImport.getFirstChild();
int startOffset = importKeyword.getTextRange().getEndOffset() + 1;
+3
View File
@@ -0,0 +1,3 @@
import kotlin.*
fun foo() {}
@@ -56,4 +56,9 @@ public class KotlinFoldingTestGenerated extends AbstractKotlinFoldingTest {
doTest("idea/testData/folding/object.kt");
}
@TestMetadata("oneImport.kt")
public void testOneImport() throws Exception {
doTest("idea/testData/folding/oneImport.kt");
}
}