1
0
mirror of https://github.com/chylex/IntelliJ-Inspection-Lens.git synced 2025-04-10 18:15:45 +02:00

Fix false positive compatibility problem in IntelliJ plugin verifier

This commit is contained in:
chylex 2022-10-06 00:27:02 +02:00
parent fd50ca90b6
commit 0e380a4658
Signed by: chylex
GPG Key ID: 4DE42C8F19A80548

View File

@ -63,17 +63,18 @@ class LensMarkupModelListener private constructor(editor: Editor) : MarkupModelL
companion object {
private val MINIMUM_SEVERITY = HighlightSeverity.TEXT_ATTRIBUTES.myVal + 1
private fun getHighlightInfoIfValid(highlighter: RangeHighlighter): HighlightInfo? {
return if (highlighter.isValid)
HighlightInfo.fromRangeHighlighter(highlighter)?.takeIf { it.severity.myVal >= MINIMUM_SEVERITY }
else
null
}
private inline fun runWithHighlighterIfValid(highlighter: RangeHighlighter, actionForImmediate: (HighlighterWithInfo) -> Unit, actionForAsync: (HighlighterWithInfo.Async) -> Unit) {
if (!highlighter.isValid) {
return
val info = getHighlightInfoIfValid(highlighter)
if (info != null) {
processHighlighterWithInfo(HighlighterWithInfo.from(highlighter, info), actionForImmediate, actionForAsync)
}
val info = HighlightInfo.fromRangeHighlighter(highlighter)
if (info == null || info.severity.myVal < MINIMUM_SEVERITY) {
return
}
processHighlighterWithInfo(HighlighterWithInfo.from(highlighter, info), actionForImmediate, actionForAsync)
}
private inline fun processHighlighterWithInfo(highlighterWithInfo: HighlighterWithInfo, actionForImmediate: (HighlighterWithInfo) -> Unit, actionForAsync: (HighlighterWithInfo.Async) -> Unit) {