Skip to content

Commit dba9011

Browse files
committed
Check for batch PSI children update when invalidating package cache
#KT-17868 fixed
1 parent 92a7635 commit dba9011

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/PerModulePackageCacheService.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import org.jetbrains.kotlin.idea.stubindex.PackageIndexUtil
3636
import org.jetbrains.kotlin.name.FqName
3737
import org.jetbrains.kotlin.psi.KtFile
3838
import org.jetbrains.kotlin.psi.KtPackageDirective
39+
import org.jetbrains.kotlin.psi.psiUtil.getChildrenOfType
3940
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
4041
import java.util.concurrent.ConcurrentMap
4142

@@ -73,6 +74,11 @@ class KotlinPackageStatementPsiTreeChangePreprocessor(private val project: Proje
7374
if (child.getParentOfType<KtPackageDirective>(false) != null)
7475
project.service<PerModulePackageCacheService>().notifyPackageChange(file)
7576
}
77+
PsiTreeChangeEventImpl.PsiEventType.CHILDREN_CHANGED -> {
78+
val parent = event.parent ?: return
79+
if (parent.getChildrenOfType<KtPackageDirective>().any())
80+
project.service<PerModulePackageCacheService>().notifyPackageChange(file)
81+
}
7682
else -> {
7783
}
7884
}

0 commit comments

Comments
 (0)