Do not analyze kotlin source files in jars for java projects
This commit is contained in:
committed by
Alexander Udalov
parent
7dd0613f96
commit
8c041f56cc
+15
-3
@@ -23,6 +23,8 @@ import org.jetbrains.jet.lang.resolve.lazy.declarations.DeclarationProviderFacto
|
|||||||
import org.jetbrains.jet.lang.resolve.lazy.declarations.DeclarationProviderFactoryService
|
import org.jetbrains.jet.lang.resolve.lazy.declarations.DeclarationProviderFactoryService
|
||||||
import org.jetbrains.jet.storage.StorageManager
|
import org.jetbrains.jet.storage.StorageManager
|
||||||
import org.jetbrains.jet.plugin.stubindex.JetSourceFilterScope
|
import org.jetbrains.jet.plugin.stubindex.JetSourceFilterScope
|
||||||
|
import com.intellij.openapi.module.ModuleManager
|
||||||
|
import org.jetbrains.jet.plugin.project.ProjectStructureUtil
|
||||||
|
|
||||||
public class PluginDeclarationProviderFactoryService : DeclarationProviderFactoryService() {
|
public class PluginDeclarationProviderFactoryService : DeclarationProviderFactoryService() {
|
||||||
|
|
||||||
@@ -32,8 +34,18 @@ public class PluginDeclarationProviderFactoryService : DeclarationProviderFactor
|
|||||||
syntheticFiles: Collection<JetFile>,
|
syntheticFiles: Collection<JetFile>,
|
||||||
filesScope: GlobalSearchScope
|
filesScope: GlobalSearchScope
|
||||||
): DeclarationProviderFactory {
|
): DeclarationProviderFactory {
|
||||||
//NOTE: we include libraries here to support analyzing JavaScript libraries which are kotlin sources in classes root
|
val scope = if (isJsProject(project)) {
|
||||||
return PluginDeclarationProviderFactory(project, JetSourceFilterScope.kotlinSourcesAndLibraries(filesScope, project),
|
//NOTE: we include libraries here to support analyzing JavaScript libraries which are kotlin sources in classes root
|
||||||
storageManager, syntheticFiles)
|
JetSourceFilterScope.kotlinSourcesAndLibraries(filesScope, project)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
JetSourceFilterScope.kotlinSources(filesScope, project)
|
||||||
|
}
|
||||||
|
return PluginDeclarationProviderFactory(project, scope, storageManager, syntheticFiles)
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: (module refactoring) get rid of this when there is no single module resolve in plugin
|
||||||
|
private fun isJsProject(project: Project): Boolean {
|
||||||
|
return ModuleManager.getInstance(project).getModules().any { ProjectStructureUtil.isJsKotlinModule(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user