|
|
@ -11,17 +11,18 @@ import com.intellij.openapi.roots.* |
|
|
|
import com.intellij.psi.* |
|
|
|
import com.intellij.psi.* |
|
|
|
import com.intellij.psi.search.* |
|
|
|
import com.intellij.psi.search.* |
|
|
|
import com.intellij.psi.util.* |
|
|
|
import com.intellij.psi.util.* |
|
|
|
|
|
|
|
import org.jetbrains.kotlin.idea.stubindex.KotlinFullClassNameIndex |
|
|
|
import org.jetbrains.kotlin.idea.util.* |
|
|
|
import org.jetbrains.kotlin.idea.util.* |
|
|
|
|
|
|
|
|
|
|
|
fun PsiElement.inComposeModule() = module?.isComposeModule() ?: false |
|
|
|
fun PsiElement.inComposeModule() = module?.isComposeModule() ?: false |
|
|
|
fun Module.isComposeModule(): Boolean { |
|
|
|
fun Module.isComposeModule(): Boolean { |
|
|
|
return CachedValuesManager.getManager(project).getCachedValue(this) { |
|
|
|
return CachedValuesManager.getManager(project).getCachedValue(this) { |
|
|
|
val javaPsiFacade = JavaPsiFacade.getInstance(this.project) |
|
|
|
val scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(this) |
|
|
|
val value = COMPOSABLE_FQ_NAMES.any { |
|
|
|
val hasComposable = COMPOSABLE_FQ_NAMES.any { |
|
|
|
javaPsiFacade.findClass(it, GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(this)) != null |
|
|
|
KotlinFullClassNameIndex.getInstance().get(it, project, scope).any() |
|
|
|
} |
|
|
|
} |
|
|
|
val rootModificationTracker = ProjectRootModificationTracker.getInstance(project) |
|
|
|
val rootModificationTracker = ProjectRootModificationTracker.getInstance(project) |
|
|
|
CachedValueProvider.Result.create(value, rootModificationTracker) |
|
|
|
CachedValueProvider.Result.create(hasComposable, rootModificationTracker) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|