Line Markers: Respect subclass module when filtering out duplicates
#KT-21010 Fixed
This commit is contained in:
committed by
Nikolay Krasko
parent
d37c8397f5
commit
f3dad53ad4
@@ -12,6 +12,7 @@ import com.intellij.codeInsight.daemon.impl.MarkerType
|
||||
import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator
|
||||
import com.intellij.codeInsight.navigation.ListBackgroundUpdaterTask
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.ide.util.PsiClassOrFunctionalExpressionListCellRenderer
|
||||
import com.intellij.openapi.actionSystem.IdeActions
|
||||
import com.intellij.openapi.editor.colors.CodeInsightColors
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager
|
||||
@@ -42,6 +43,7 @@ import org.jetbrains.kotlin.idea.facet.implementedDescriptor
|
||||
import org.jetbrains.kotlin.idea.facet.implementingDescriptors
|
||||
import org.jetbrains.kotlin.idea.search.declarationsSearch.toPossiblyFakeLightMethods
|
||||
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil
|
||||
import org.jetbrains.kotlin.idea.util.module
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getPrevSiblingIgnoringWhitespaceAndComments
|
||||
@@ -155,12 +157,20 @@ interface TestableLineMarkerNavigator {
|
||||
fun getTargetsPopupDescriptor(element: PsiElement?): NavigationPopupDescriptor?
|
||||
}
|
||||
|
||||
private class SubclassRenderer: PsiClassOrFunctionalExpressionListCellRenderer() {
|
||||
override fun getComparingObject(element: NavigatablePsiElement?): Comparable<Nothing> {
|
||||
val baseText = super.getComparingObject(element)
|
||||
val moduleName = element?.module?.name ?: return baseText
|
||||
return "$baseText [$moduleName]"
|
||||
}
|
||||
}
|
||||
|
||||
private val SUBCLASSED_CLASS = MarkerType(
|
||||
"SUBCLASSED_CLASS",
|
||||
{ getPsiClass(it)?.let { MarkerType.getSubclassedClassTooltip(it) } },
|
||||
object : LineMarkerNavigator() {
|
||||
override fun browse(e: MouseEvent?, element: PsiElement?) {
|
||||
getPsiClass(element)?.let { MarkerType.navigateToSubclassedClass(e, it) }
|
||||
getPsiClass(element)?.let { MarkerType.navigateToSubclassedClass(e, it, SubclassRenderer()) }
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user