Show line markers for sealed classes
#KT-16755 Fixed
This commit is contained in:
@@ -45,6 +45,7 @@ import org.jetbrains.kotlin.idea.highlighter.allImplementingCompatibleModules
|
||||
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.isInheritable
|
||||
import org.jetbrains.kotlin.psi.psiUtil.isOverridable
|
||||
import java.awt.event.MouseEvent
|
||||
import java.util.*
|
||||
@@ -227,8 +228,7 @@ private fun collectSuperDeclarationMarkers(declaration: KtDeclaration, result: M
|
||||
}
|
||||
|
||||
private fun collectInheritedClassMarker(element: KtClass, result: MutableCollection<LineMarkerInfo<*>>) {
|
||||
val isTrait = element.isInterface()
|
||||
if (!(isTrait || element.hasModifier(KtTokens.OPEN_KEYWORD) || element.hasModifier(KtTokens.ABSTRACT_KEYWORD))) {
|
||||
if (!element.isInheritable()) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ private fun collectInheritedClassMarker(element: KtClass, result: MutableCollect
|
||||
result.add(LineMarkerInfo(
|
||||
anchor,
|
||||
anchor.textRange,
|
||||
if (isTrait) IMPLEMENTED_MARK else OVERRIDDEN_MARK,
|
||||
if (element.isInterface()) IMPLEMENTED_MARK else OVERRIDDEN_MARK,
|
||||
Pass.LINE_MARKERS,
|
||||
SUBCLASSED_CLASS.tooltip,
|
||||
SUBCLASSED_CLASS.navigationHandler,
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
sealed class <lineMarker>A</lineMarker> {
|
||||
open fun <lineMarker>a</lineMarker>(){
|
||||
}
|
||||
}
|
||||
|
||||
class B:A(){
|
||||
override fun <lineMarker>a</lineMarker>(){
|
||||
}
|
||||
}
|
||||
@@ -182,6 +182,12 @@ public class LineMarkersTestGenerated extends AbstractLineMarkersTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("SealedClass.kt")
|
||||
public void testSealedClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/lineMarker/overrideImplement/SealedClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ToStringInTrait.kt")
|
||||
public void testToStringInTrait() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/lineMarker/overrideImplement/ToStringInTrait.kt");
|
||||
|
||||
Reference in New Issue
Block a user