From 8d055f695266262cc941ecdfb6e84385da15c563 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Fri, 24 Jun 2016 14:20:13 +0300 Subject: [PATCH] Use file.modificationStamp to invalidate caches for synthetic files It previously worked because of updating all counters. That behaviour was removed in https://github.com/JetBrains/intellij-community/commit/3b860d69ee1b32b210ddf88b1e042dd70ea87cd9. getUserData(FILE_OUT_OF_BLOCK_MODIFICATION_COUNT) is probably useless because copied file has isEventSystemEnabled() == false that prevents sending notifications about PSI changes. This need additional checks. --- .../kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt index 0686686d4c1..fa4f7d8740d 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt @@ -137,7 +137,8 @@ class KotlinCacheServiceImpl(val project: Project) : KotlinCacheService { val syntheticFileModule = files.map { it.getModuleInfo() }.toSet().single() val sdk = syntheticFileModule.sdk val filesModificationTracker = ModificationTracker { - files.sumByLong { it.outOfBlockModificationCount } + // TODO: Check getUserData(FILE_OUT_OF_BLOCK_MODIFICATION_COUNT) actually works + files.sumByLong { it.outOfBlockModificationCount + it.modificationStamp } } val dependenciesForSyntheticFileCache = listOf(PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, filesModificationTracker) val debugName = "completion/highlighting in $syntheticFileModule for files ${files.joinToString { it.name }} for platform $targetPlatform"