KotlinCacheService: Correctly deal with code fragments in getLazyResolveSession()

Fix completion in code fragments in context of library source
This commit is contained in:
Pavel V. Talanov
2014-10-20 19:18:21 +04:00
parent e88db57214
commit 0070377f2a
@@ -171,8 +171,9 @@ public class KotlinCacheService(val project: Project) {
public fun getLazyResolveSession(element: JetElement): ResolveSessionForBodies {
val file = element.getContainingJetFile()
if (!ProjectRootsUtil.isInProjectSource(file)) {
return getCacheForSyntheticFile(setOf(file)).getLazyResolveSession(file)
val syntheticFiles = findSyntheticFiles(listOf(file))
if (syntheticFiles.isNotEmpty()) {
return getCacheForSyntheticFile(syntheticFiles).getLazyResolveSession(file)
}
return getGlobalLazyResolveSession(file, TargetPlatformDetector.getPlatform(file))