Index file facades by short names

This commit is contained in:
Pavel V. Talanov
2015-09-09 15:58:17 +03:00
parent 3d0b737916
commit 0257ea6fd8
3 changed files with 38 additions and 0 deletions
@@ -46,6 +46,7 @@ public class IdeStubIndexService extends StubIndexService {
FqName facadeFqName = ((KotlinFileStubForIde) stub).getFacadeFqName();
if (facadeFqName != null) {
sink.occurrence(JetFileFacadeFqNameIndex.INSTANCE.getKey(), facadeFqName.asString());
sink.occurrence(JetFileFacadeShortNameIndex.INSTANCE.getKey(), facadeFqName.shortName().asString());
sink.occurrence(JetFileFacadeClassByPackageIndex.INSTANCE.getKey(), packageFqName.asString());
}
@@ -0,0 +1,36 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.idea.stubindex
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.stubs.StringStubIndexExtension
import com.intellij.psi.stubs.StubIndexKey
import org.jetbrains.kotlin.psi.JetFile
public class JetFileFacadeShortNameIndex private constructor() : StringStubIndexExtension<JetFile>() {
override fun getKey(): StubIndexKey<String, JetFile> = KEY
override fun get(key: String, project: Project, scope: GlobalSearchScope) =
super.get(key, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
companion object {
private val KEY = KotlinIndexUtil.createIndexKey(JetFileFacadeShortNameIndex::class.java)
public val INSTANCE: JetFileFacadeShortNameIndex = JetFileFacadeShortNameIndex()
public @jvmStatic fun getInstance(): JetFileFacadeShortNameIndex = INSTANCE
}
}
+1
View File
@@ -503,6 +503,7 @@
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetFileFacadeFqNameIndex"/>
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetFilePartClassIndex"/>
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetFileFacadeClassByPackageIndex"/>
<stubIndex implementation="org.jetbrains.kotlin.idea.stubindex.JetFileFacadeShortNameIndex"/>
<psi.classFileDecompiler implementation="org.jetbrains.kotlin.idea.decompiler.JetClassFileDecompiler"/>
<psi.classFileDecompiler implementation="org.jetbrains.kotlin.idea.decompiler.KotlinJavaScriptMetaFileDecompiler"/>