Make collectSlowLineMarker handle parents to deal with changes correctly
So #KT-20825 Fixed So #KT-21113 Fixed Related to IDEA-141330 fix
This commit is contained in:
+18
-17
@@ -20,10 +20,7 @@ import com.intellij.openapi.editor.markup.SeparatorPlacement
|
|||||||
import com.intellij.openapi.progress.ProgressManager
|
import com.intellij.openapi.progress.ProgressManager
|
||||||
import com.intellij.openapi.project.DumbService
|
import com.intellij.openapi.project.DumbService
|
||||||
import com.intellij.openapi.util.text.StringUtil
|
import com.intellij.openapi.util.text.StringUtil
|
||||||
import com.intellij.psi.NavigatablePsiElement
|
import com.intellij.psi.*
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.PsiMethod
|
|
||||||
import com.intellij.psi.PsiNameIdentifierOwner
|
|
||||||
import com.intellij.psi.search.searches.ClassInheritorsSearch
|
import com.intellij.psi.search.searches.ClassInheritorsSearch
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
import com.intellij.psi.util.PsiTreeUtil
|
||||||
import org.jetbrains.kotlin.asJava.LightClassUtil
|
import org.jetbrains.kotlin.asJava.LightClassUtil
|
||||||
@@ -87,11 +84,14 @@ class KotlinLineMarkerProvider : LineMarkerProvider {
|
|||||||
val first = elements.first()
|
val first = elements.first()
|
||||||
if (DumbService.getInstance(first.project).isDumb || !ProjectRootsUtil.isInProjectOrLibSource(first)) return
|
if (DumbService.getInstance(first.project).isDumb || !ProjectRootsUtil.isInProjectOrLibSource(first)) return
|
||||||
|
|
||||||
val functions = HashSet<KtNamedFunction>()
|
val functions = hashSetOf<KtNamedFunction>()
|
||||||
val properties = HashSet<KtNamedDeclaration>()
|
val properties = hashSetOf<KtNamedDeclaration>()
|
||||||
|
val declarations = hashSetOf<KtNamedDeclaration>()
|
||||||
|
|
||||||
for (element in elements) {
|
for (leaf in elements) {
|
||||||
ProgressManager.checkCanceled()
|
ProgressManager.checkCanceled()
|
||||||
|
val element = leaf.parent as? KtNamedDeclaration ?: continue
|
||||||
|
if (!declarations.add(element)) continue
|
||||||
|
|
||||||
when (element) {
|
when (element) {
|
||||||
is KtClass -> {
|
is KtClass -> {
|
||||||
@@ -113,20 +113,11 @@ class KotlinLineMarkerProvider : LineMarkerProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
collectMultiplatformMarkers(element, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
collectOverriddenFunctions(functions, result)
|
collectOverriddenFunctions(functions, result)
|
||||||
collectOverriddenPropertyAccessors(properties, result)
|
collectOverriddenPropertyAccessors(properties, result)
|
||||||
|
|
||||||
for (element in elements) {
|
|
||||||
if (element !is KtNamedDeclaration) continue
|
|
||||||
|
|
||||||
if (element.isExpectDeclaration()) {
|
|
||||||
collectActualMarkers(element, result)
|
|
||||||
} else if (element.isEffectivelyActual()) {
|
|
||||||
collectExpectedMarkers(element, result)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,6 +330,16 @@ private val KtNamedDeclaration.expectOrActualAnchor
|
|||||||
else -> null
|
else -> null
|
||||||
} ?: this
|
} ?: this
|
||||||
|
|
||||||
|
private fun collectMultiplatformMarkers(
|
||||||
|
declaration: KtNamedDeclaration,
|
||||||
|
result: MutableCollection<LineMarkerInfo<*>>
|
||||||
|
) {
|
||||||
|
when {
|
||||||
|
declaration.isExpectDeclaration() -> collectActualMarkers(declaration, result)
|
||||||
|
declaration.isEffectivelyActual() -> collectExpectedMarkers(declaration, result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun collectActualMarkers(
|
private fun collectActualMarkers(
|
||||||
declaration: KtNamedDeclaration,
|
declaration: KtNamedDeclaration,
|
||||||
result: MutableCollection<LineMarkerInfo<*>>
|
result: MutableCollection<LineMarkerInfo<*>>
|
||||||
|
|||||||
+18
-17
@@ -20,10 +20,7 @@ import com.intellij.openapi.editor.markup.SeparatorPlacement
|
|||||||
import com.intellij.openapi.progress.ProgressManager
|
import com.intellij.openapi.progress.ProgressManager
|
||||||
import com.intellij.openapi.project.DumbService
|
import com.intellij.openapi.project.DumbService
|
||||||
import com.intellij.openapi.util.text.StringUtil
|
import com.intellij.openapi.util.text.StringUtil
|
||||||
import com.intellij.psi.NavigatablePsiElement
|
import com.intellij.psi.*
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.PsiMethod
|
|
||||||
import com.intellij.psi.PsiNameIdentifierOwner
|
|
||||||
import com.intellij.psi.search.searches.ClassInheritorsSearch
|
import com.intellij.psi.search.searches.ClassInheritorsSearch
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
import com.intellij.psi.util.PsiTreeUtil
|
||||||
import org.jetbrains.kotlin.asJava.LightClassUtil
|
import org.jetbrains.kotlin.asJava.LightClassUtil
|
||||||
@@ -87,11 +84,14 @@ class KotlinLineMarkerProvider : LineMarkerProvider {
|
|||||||
val first = elements.first()
|
val first = elements.first()
|
||||||
if (DumbService.getInstance(first.project).isDumb || !ProjectRootsUtil.isInProjectOrLibSource(first)) return
|
if (DumbService.getInstance(first.project).isDumb || !ProjectRootsUtil.isInProjectOrLibSource(first)) return
|
||||||
|
|
||||||
val functions = HashSet<KtNamedFunction>()
|
val functions = hashSetOf<KtNamedFunction>()
|
||||||
val properties = HashSet<KtNamedDeclaration>()
|
val properties = hashSetOf<KtNamedDeclaration>()
|
||||||
|
val declarations = hashSetOf<KtNamedDeclaration>()
|
||||||
|
|
||||||
for (element in elements) {
|
for (leaf in elements) {
|
||||||
ProgressManager.checkCanceled()
|
ProgressManager.checkCanceled()
|
||||||
|
val element = leaf.parent as? KtNamedDeclaration ?: continue
|
||||||
|
if (!declarations.add(element)) continue
|
||||||
|
|
||||||
when (element) {
|
when (element) {
|
||||||
is KtClass -> {
|
is KtClass -> {
|
||||||
@@ -113,20 +113,11 @@ class KotlinLineMarkerProvider : LineMarkerProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
collectMultiplatformMarkers(element, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
collectOverriddenFunctions(functions, result)
|
collectOverriddenFunctions(functions, result)
|
||||||
collectOverriddenPropertyAccessors(properties, result)
|
collectOverriddenPropertyAccessors(properties, result)
|
||||||
|
|
||||||
for (element in elements) {
|
|
||||||
if (element !is KtNamedDeclaration) continue
|
|
||||||
|
|
||||||
if (element.isExpectDeclaration()) {
|
|
||||||
collectActualMarkers(element, result)
|
|
||||||
} else if (element.isEffectivelyActual()) {
|
|
||||||
collectExpectedMarkers(element, result)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,6 +328,16 @@ private val KtNamedDeclaration.expectOrActualAnchor
|
|||||||
else -> null
|
else -> null
|
||||||
} ?: this
|
} ?: this
|
||||||
|
|
||||||
|
private fun collectMultiplatformMarkers(
|
||||||
|
declaration: KtNamedDeclaration,
|
||||||
|
result: MutableCollection<LineMarkerInfo<*>>
|
||||||
|
) {
|
||||||
|
when {
|
||||||
|
declaration.isExpectDeclaration() -> collectActualMarkers(declaration, result)
|
||||||
|
declaration.isEffectivelyActual() -> collectExpectedMarkers(declaration, result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun collectActualMarkers(
|
private fun collectActualMarkers(
|
||||||
declaration: KtNamedDeclaration,
|
declaration: KtNamedDeclaration,
|
||||||
result: MutableCollection<LineMarkerInfo<*>>
|
result: MutableCollection<LineMarkerInfo<*>>
|
||||||
|
|||||||
Reference in New Issue
Block a user