mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] KTIJ-29133 explicit platform entity used
GitOrigin-RevId: 4c8e6090fd0e3e8ccab292258ac93ddc8561add0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0d2955e41a
commit
60fdc95ca1
+12
-16
@@ -3,7 +3,6 @@ package org.jetbrains.kotlin.idea.codeinsight.api.applicable.inspections
|
||||
|
||||
import com.intellij.codeInspection.*
|
||||
import com.intellij.codeInspection.util.InspectionMessage
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiElementVisitor
|
||||
import org.jetbrains.kotlin.idea.codeinsight.api.applicable.KotlinApplicableToolBase
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
@@ -16,12 +15,6 @@ import org.jetbrains.kotlin.psi.KtVisitor
|
||||
abstract class AbstractKotlinApplicableInspectionBase<ELEMENT : KtElement> : LocalInspectionTool(),
|
||||
KotlinApplicableToolBase<ELEMENT> {
|
||||
|
||||
/**
|
||||
* By default, a problem is registered for every [TextRange] produced by [getApplicabilityRange]. [getProblemRanges] can be overridden
|
||||
* to customize this behavior, e.g. to register a problem only for the first [TextRange].
|
||||
*/
|
||||
open fun getProblemRanges(ranges: List<TextRange>): List<TextRange> = ranges
|
||||
|
||||
internal class ProblemInfo(
|
||||
val description: @InspectionMessage String,
|
||||
val highlightType: ProblemHighlightType,
|
||||
@@ -43,15 +36,18 @@ abstract class AbstractKotlinApplicableInspectionBase<ELEMENT : KtElement> : Loc
|
||||
if (!isOnTheFly && problemInfo.highlightType == ProblemHighlightType.INFORMATION) {
|
||||
return
|
||||
}
|
||||
getProblemRanges(ranges).forEach { range ->
|
||||
holder.registerProblem(
|
||||
element,
|
||||
problemInfo.description,
|
||||
problemInfo.highlightType,
|
||||
range,
|
||||
problemInfo.quickFix,
|
||||
)
|
||||
}
|
||||
|
||||
ranges.asSequence()
|
||||
.map { rangeInElement ->
|
||||
holder.manager.createProblemDescriptor(
|
||||
/* psiElement = */ element,
|
||||
/* rangeInElement = */ rangeInElement,
|
||||
/* descriptionTemplate = */ problemInfo.description,
|
||||
/* highlightType = */ problemInfo.highlightType,
|
||||
/* onTheFly = */ isOnTheFly,
|
||||
/* ...fixes = */ problemInfo.quickFix,
|
||||
)
|
||||
}.forEach(holder::registerProblem)
|
||||
}
|
||||
|
||||
abstract override fun buildVisitor(
|
||||
|
||||
Reference in New Issue
Block a user