Minor: rename index
This commit is contained in:
@@ -27,7 +27,7 @@ import com.intellij.util.containers.ContainerUtil
|
|||||||
import com.intellij.util.containers.HashSet
|
import com.intellij.util.containers.HashSet
|
||||||
import org.jetbrains.kotlin.asJava.JavaElementFinder
|
import org.jetbrains.kotlin.asJava.JavaElementFinder
|
||||||
import org.jetbrains.kotlin.idea.stubindex.JetClassShortNameIndex
|
import org.jetbrains.kotlin.idea.stubindex.JetClassShortNameIndex
|
||||||
import org.jetbrains.kotlin.idea.stubindex.JetFileFacadeClassIndex
|
import org.jetbrains.kotlin.idea.stubindex.JetFileFacadeFqNameIndex
|
||||||
import org.jetbrains.kotlin.idea.stubindex.JetFunctionShortNameIndex
|
import org.jetbrains.kotlin.idea.stubindex.JetFunctionShortNameIndex
|
||||||
import org.jetbrains.kotlin.idea.stubindex.PackageIndexUtil
|
import org.jetbrains.kotlin.idea.stubindex.PackageIndexUtil
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
@@ -43,7 +43,7 @@ public class JetShortNamesCache(private val project: Project) : PsiShortNamesCac
|
|||||||
// package classes can not be indexed, since they have no explicit declarations
|
// package classes can not be indexed, since they have no explicit declarations
|
||||||
val packageClassShortNames = PackageIndexUtil.getAllPossiblePackageClasses(project).keySet()
|
val packageClassShortNames = PackageIndexUtil.getAllPossiblePackageClasses(project).keySet()
|
||||||
classNames.addAll(packageClassShortNames)
|
classNames.addAll(packageClassShortNames)
|
||||||
classNames.addAll(JetFileFacadeClassIndex.getAllFacadeShortNames(project))
|
classNames.addAll(JetFileFacadeFqNameIndex.getAllFacadeShortNames(project))
|
||||||
|
|
||||||
return classNames.toTypedArray()
|
return classNames.toTypedArray()
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ public class JetShortNamesCache(private val project: Project) : PsiShortNamesCac
|
|||||||
val packageClasses = PackageIndexUtil.getAllPossiblePackageClasses(project)
|
val packageClasses = PackageIndexUtil.getAllPossiblePackageClasses(project)
|
||||||
|
|
||||||
// package classes can not be indexed, since they have no explicit declarations
|
// package classes can not be indexed, since they have no explicit declarations
|
||||||
val fqNames = packageClasses.get(name) + JetFileFacadeClassIndex.getInstance().getAllKeys(project).map { FqName(it) }.filter { it.shortName().asString() == name }
|
val fqNames = packageClasses.get(name) + JetFileFacadeFqNameIndex.getInstance().getAllKeys(project).map { FqName(it) }.filter { it.shortName().asString() == name }
|
||||||
for (fqName in fqNames) {
|
for (fqName in fqNames) {
|
||||||
val psiClass = JavaElementFinder.getInstance(project).findClass(fqName.asString(), scope)
|
val psiClass = JavaElementFinder.getInstance(project).findClass(fqName.asString(), scope)
|
||||||
if (psiClass != null) {
|
if (psiClass != null) {
|
||||||
|
|||||||
+1
-1
@@ -215,7 +215,7 @@ public class IDELightClassGenerationSupport(private val project: Project) : Ligh
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun findFilesForFacade(facadeFqName: FqName, scope: GlobalSearchScope): Collection<JetFile> {
|
override fun findFilesForFacade(facadeFqName: FqName, scope: GlobalSearchScope): Collection<JetFile> {
|
||||||
return JetFileFacadeClassIndex.INSTANCE.get(facadeFqName.asString(), project, scope)
|
return JetFileFacadeFqNameIndex.INSTANCE.get(facadeFqName.asString(), project, scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun resolveClassToDescriptor(classOrObject: JetClassOrObject): ClassDescriptor? {
|
override fun resolveClassToDescriptor(classOrObject: JetClassOrObject): ClassDescriptor? {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class IdeStubIndexService extends StubIndexService {
|
|||||||
|
|
||||||
FqName facadeFqName = ((KotlinFileStubForIde) stub).getFacadeFqName();
|
FqName facadeFqName = ((KotlinFileStubForIde) stub).getFacadeFqName();
|
||||||
if (facadeFqName != null) {
|
if (facadeFqName != null) {
|
||||||
sink.occurrence(JetFileFacadeClassIndex.INSTANCE.getKey(), facadeFqName.asString());
|
sink.occurrence(JetFileFacadeFqNameIndex.INSTANCE.getKey(), facadeFqName.asString());
|
||||||
sink.occurrence(JetFileFacadeClassByPackageIndex.INSTANCE.getKey(), packageFqName.asString());
|
sink.occurrence(JetFileFacadeClassByPackageIndex.INSTANCE.getKey(), packageFqName.asString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ public class IdeStubIndexService extends StubIndexService {
|
|||||||
JetFile jetFile = stub.getPsi();
|
JetFile jetFile = stub.getPsi();
|
||||||
if (jetFile != null) {
|
if (jetFile != null) {
|
||||||
JvmFileClassInfo fileClassInfo = JvmFileClassUtil.getFileClassInfoNoResolve(jetFile);
|
JvmFileClassInfo fileClassInfo = JvmFileClassUtil.getFileClassInfoNoResolve(jetFile);
|
||||||
sink.occurrence(JetFileFacadeClassIndex.INSTANCE.getKey(), fileClassInfo.getFacadeClassFqName().asString());
|
sink.occurrence(JetFileFacadeFqNameIndex.INSTANCE.getKey(), fileClassInfo.getFacadeClassFqName().asString());
|
||||||
sink.occurrence(JetFilePartClassIndex.INSTANCE.getKey(), fileClassInfo.getFileClassFqName().asString());
|
sink.occurrence(JetFilePartClassIndex.INSTANCE.getKey(), fileClassInfo.getFileClassFqName().asString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -26,16 +26,16 @@ import com.intellij.psi.util.PsiModificationTracker
|
|||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.psi.JetFile
|
import org.jetbrains.kotlin.psi.JetFile
|
||||||
|
|
||||||
public class JetFileFacadeClassIndex private constructor() : StringStubIndexExtension<JetFile>() {
|
public class JetFileFacadeFqNameIndex private constructor() : StringStubIndexExtension<JetFile>() {
|
||||||
override fun getKey(): StubIndexKey<String, JetFile> = KEY
|
override fun getKey(): StubIndexKey<String, JetFile> = KEY
|
||||||
|
|
||||||
override fun get(key: String, project: Project, scope: GlobalSearchScope) =
|
override fun get(key: String, project: Project, scope: GlobalSearchScope) =
|
||||||
super.get(key, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
super.get(key, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val KEY = KotlinIndexUtil.createIndexKey(JetFileFacadeClassIndex::class.java)
|
private val KEY = KotlinIndexUtil.createIndexKey(JetFileFacadeFqNameIndex::class.java)
|
||||||
public val INSTANCE: JetFileFacadeClassIndex = JetFileFacadeClassIndex()
|
public val INSTANCE: JetFileFacadeFqNameIndex = JetFileFacadeFqNameIndex()
|
||||||
public @jvmStatic fun getInstance(): JetFileFacadeClassIndex = INSTANCE
|
public @jvmStatic fun getInstance(): JetFileFacadeFqNameIndex = INSTANCE
|
||||||
|
|
||||||
public fun getAllFacadeShortNames(project: Project): Collection<String> {
|
public fun getAllFacadeShortNames(project: Project): Collection<String> {
|
||||||
return CachedValuesManager.getManager(project).getCachedValue(project) {
|
return CachedValuesManager.getManager(project).getCachedValue(project) {
|
||||||
@@ -31,5 +31,5 @@ public object StaticFacadeIndexUtil {
|
|||||||
project: Project
|
project: Project
|
||||||
) : Collection<JetFile> =
|
) : Collection<JetFile> =
|
||||||
PackagePartClassUtils.getFilesWithCallables(
|
PackagePartClassUtils.getFilesWithCallables(
|
||||||
JetFileFacadeClassIndex.INSTANCE.get(partFqName.asString(), project, searchScope))
|
JetFileFacadeFqNameIndex.INSTANCE.get(partFqName.asString(), project, searchScope))
|
||||||
}
|
}
|
||||||
@@ -500,7 +500,7 @@
|
|||||||
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetAnnotationsIndex"/>
|
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetAnnotationsIndex"/>
|
||||||
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetProbablyNothingFunctionShortNameIndex"/>
|
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetProbablyNothingFunctionShortNameIndex"/>
|
||||||
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetProbablyNothingPropertyShortNameIndex"/>
|
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetProbablyNothingPropertyShortNameIndex"/>
|
||||||
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetFileFacadeClassIndex"/>
|
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetFileFacadeFqNameIndex"/>
|
||||||
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetFilePartClassIndex"/>
|
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetFilePartClassIndex"/>
|
||||||
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetFileFacadeClassByPackageIndex"/>
|
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetFileFacadeClassByPackageIndex"/>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user