Use receiver type of extension members as qualifier in Goto Symbol
#KT-17217 Fixed
This commit is contained in:
@@ -1,22 +1,10 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.goto
|
||||
|
||||
import com.intellij.navigation.ChooseByNameContributor
|
||||
import com.intellij.navigation.GotoClassContributor
|
||||
import com.intellij.navigation.NavigationItem
|
||||
import com.intellij.openapi.project.Project
|
||||
@@ -25,8 +13,10 @@ import com.intellij.psi.stubs.StubIndex
|
||||
import org.jetbrains.kotlin.asJava.LightClassUtil
|
||||
import org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInFileType
|
||||
import org.jetbrains.kotlin.idea.stubindex.*
|
||||
import org.jetbrains.kotlin.psi.KtCallableDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtEnumEntry
|
||||
import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtUserType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.containingClass
|
||||
import java.util.*
|
||||
|
||||
@@ -61,7 +51,7 @@ class KotlinGotoClassContributor : GotoClassContributor {
|
||||
* For Kotlin classes it works using light class generation.
|
||||
* We have to process Kotlin builtIn classes separately since no light classes are built for them.
|
||||
* */
|
||||
class KotlinGotoSymbolContributor : ChooseByNameContributor {
|
||||
class KotlinGotoSymbolContributor : GotoClassContributor {
|
||||
override fun getNames(project: Project, includeNonProjectItems: Boolean): Array<String> {
|
||||
return listOf(
|
||||
KotlinFunctionShortNameIndex.getInstance(),
|
||||
@@ -93,4 +83,16 @@ class KotlinGotoSymbolContributor : ChooseByNameContributor {
|
||||
|
||||
return result.toTypedArray()
|
||||
}
|
||||
|
||||
override fun getQualifiedName(item: NavigationItem): String? {
|
||||
if (item is KtCallableDeclaration) {
|
||||
val receiverType = (item.receiverTypeReference?.typeElement as? KtUserType)?.referencedName
|
||||
if (receiverType != null) {
|
||||
return "$receiverType.${item.name}"
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getQualifiedNameSeparator(): String = "."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user