Don't show KDoc references in Call Hierarchy

^KT-39558 Fixed
This commit is contained in:
Nikita Bobko
2020-06-12 18:55:18 +03:00
parent a79efd0768
commit b43ff7fbf9
4 changed files with 22 additions and 1 deletions
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.idea.findUsages.KotlinClassFindUsagesOptions
import org.jetbrains.kotlin.idea.findUsages.KotlinFunctionFindUsagesOptions
import org.jetbrains.kotlin.idea.findUsages.KotlinPropertyFindUsagesOptions
import org.jetbrains.kotlin.idea.findUsages.processAllUsages
import org.jetbrains.kotlin.kdoc.psi.api.KDoc
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
@@ -98,7 +99,8 @@ class KotlinCallerTreeStructure(
// If reference belongs to property initializer, show enclosing declaration instead
elementToSearch.processAllUsages(findOptions) {
val refElement = it.element
if (refElement != null && !JavaResolveUtil.isInJavaDoc(refElement)) {
val isInKDoc = PsiTreeUtil.getParentOfType(refElement, KDoc::class.java) != null
if (refElement != null && !JavaResolveUtil.isInJavaDoc(refElement) && !isInKDoc) {
processReference(it.reference, refElement, nodeDescriptor, callerToDescriptorMap, false)
}
}
@@ -0,0 +1,2 @@
<node text="K.persist() ()" base="true">
</node>
@@ -0,0 +1,12 @@
open class K {
public fun <caret>persist() {}
}
class Foo : K() {
/**
* [persist]
*/
fun foo() {
}
}
@@ -319,6 +319,11 @@ public class HierarchyTestGenerated extends AbstractHierarchyTest {
runTest("idea/testData/hierarchy/calls/callers/insideJavadoc/");
}
@TestMetadata("insideKDoc")
public void testInsideKDoc() throws Exception {
runTest("idea/testData/hierarchy/calls/callers/insideKDoc/");
}
@TestMetadata("kotlinClass")
public void testKotlinClass() throws Exception {
runTest("idea/testData/hierarchy/calls/callers/kotlinClass/");