From 24f1635d2c2349311ab4b698fe5eeac3943a6990 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Thu, 18 Dec 2014 19:48:53 +0300 Subject: [PATCH] Filter out duplicate navigation targets for references in library source --- .../jet/plugin/codeInsight/DescriptorToDeclarationUtil.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/idea/idea-analysis/src/org/jetbrains/jet/plugin/codeInsight/DescriptorToDeclarationUtil.kt b/idea/idea-analysis/src/org/jetbrains/jet/plugin/codeInsight/DescriptorToDeclarationUtil.kt index 593c45295bb..b309ab9926d 100644 --- a/idea/idea-analysis/src/org/jetbrains/jet/plugin/codeInsight/DescriptorToDeclarationUtil.kt +++ b/idea/idea-analysis/src/org/jetbrains/jet/plugin/codeInsight/DescriptorToDeclarationUtil.kt @@ -57,7 +57,9 @@ public object DescriptorToDeclarationUtil { result.addIfNotNull(psiFacade.findPackage(fqName)) result.addIfNotNull(psiFacade.findClass(fqName, project.allScope())) } - return result + // filter out elements which are navigate to some other element of the result + // this is needed to avoid duplicated results for references to declaration in same library source file + return result.filter { element -> result.none { element != it && it.getNavigationElement() == element } } } private fun findDecompiledAndBuiltInDeclarations(project: Project, descriptor: DeclarationDescriptor): Collection {