summaryrefslogtreecommitdiff
path: root/plugins/kotlin/fir/src/org/jetbrains/kotlin/idea/fir/highlighter/visitors/FirAfterResolveHighlightingVisitor.kt
blob: ff64768728bb3fc5b88109da44c92ed25519f7bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.jetbrains.kotlin.idea.fir.highlighter.visitors

import com.intellij.lang.annotation.AnnotationHolder
import com.intellij.lang.annotation.HighlightSeverity
import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.openapi.util.TextRange
import com.intellij.util.applyIf
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.idea.fir.highlighter.HiglightingFactory
import org.jetbrains.kotlin.idea.highlighter.AbstractHighlightingVisitor

abstract class FirAfterResolveHighlightingVisitor(
    protected val analysisSession: KtAnalysisSession,
    private val holder: AnnotationHolder
) : AbstractHighlightingVisitor() {

    override fun createInfoAnnotation(textRange: TextRange, message: String?, textAttributes: TextAttributesKey?) {
        HiglightingFactory.createInfoAnnotation(holder, textRange, message, textAttributes)
    }

    companion object {
        fun createListOfVisitors(
            analysisSession: KtAnalysisSession,
            holder: AnnotationHolder
        ): List<FirAfterResolveHighlightingVisitor> = listOf(
            TypeHighlightingVisitor(analysisSession, holder),
            FunctionCallHighlightingVisitor(analysisSession, holder),
            ExpressionsSmartcastHighlightingVisitor(analysisSession, holder),
            VariableReferenceHighlightingVisitor(analysisSession, holder),
        )
    }
}