KotlinSpringClassAnnotator ignores duplicate gutter handlers (IDEA-173995, KT-18298)
This commit is contained in:
committed by
Nikolay Krasko
parent
ce77751349
commit
ca19ea8205
+14
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.spring.lineMarking
|
package org.jetbrains.kotlin.idea.spring.lineMarking
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.daemon.GutterIconNavigationHandler
|
||||||
import com.intellij.codeInsight.daemon.LineMarkerInfo
|
import com.intellij.codeInsight.daemon.LineMarkerInfo
|
||||||
import com.intellij.codeInsight.daemon.RelatedItemLineMarkerInfo
|
import com.intellij.codeInsight.daemon.RelatedItemLineMarkerInfo
|
||||||
import com.intellij.navigation.GotoRelatedItem
|
import com.intellij.navigation.GotoRelatedItem
|
||||||
@@ -105,6 +106,7 @@ class KotlinSpringClassAnnotator : SpringClassAnnotator() {
|
|||||||
else -> return@mapNotNullTo item
|
else -> return@mapNotNullTo item
|
||||||
}
|
}
|
||||||
if (elementToAnnotate == null) return@mapNotNullTo null
|
if (elementToAnnotate == null) return@mapNotNullTo null
|
||||||
|
if (alreadyMarked(result, elementToAnnotate, item.navigationHandler)) return@mapNotNullTo null
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
RelatedItemLineMarkerInfo<PsiElement>(
|
RelatedItemLineMarkerInfo<PsiElement>(
|
||||||
@@ -119,4 +121,16 @@ class KotlinSpringClassAnnotator : SpringClassAnnotator() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun alreadyMarked(result: MutableCollection<in RelatedItemLineMarkerInfo<PsiElement>>,
|
||||||
|
elementToAnnotate: PsiElement,
|
||||||
|
navigationHandler: GutterIconNavigationHandler<*>?) =
|
||||||
|
result.any {
|
||||||
|
when (it) {
|
||||||
|
is RelatedItemLineMarkerInfo<*> -> {
|
||||||
|
it.element == elementToAnnotate && it.navigationHandler == navigationHandler
|
||||||
|
}
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user