Do not fold imports if there is only one
#KT-3410 Fixed
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user