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 {