@@ -34,9 +34,6 @@ internal val KOTLIN_MATH_OPERATOR_FUN: TextAttributesKey =
34
34
*/
35
35
private class KotlinAnnotator : Annotator {
36
36
private val globalScheme = EditorColorsManager .getInstance().globalScheme
37
- private val infixFunAttributes = globalScheme.getAttributes(KOTLIN_INFIX_FUN )
38
- private val keywordOperatorFunAttributes = globalScheme.getAttributes(KOTLIN_KEYWORD_OPERATOR_FUN )
39
- private val mathOperatorFunAttributes = globalScheme.getAttributes(KOTLIN_MATH_OPERATOR_FUN )
40
37
41
38
override fun annotate (element : PsiElement , annotationHolder : AnnotationHolder ) {
42
39
if (element is KtOperationReferenceExpression ) {
@@ -49,9 +46,9 @@ private class KotlinAnnotator : Annotator {
49
46
private fun getTextAttributes (expr : KtOperationReferenceExpression ): TextAttributes ? {
50
47
val operationSignTokenType = expr.operationSignTokenType
51
48
return when {
52
- ! expr.isConventionOperator() -> infixFunAttributes
53
- operationSignTokenType is KtKeywordToken -> keywordOperatorFunAttributes
54
- operationSignTokenType is KtSingleValueToken -> mathOperatorFunAttributes
49
+ operationSignTokenType is KtKeywordToken -> KOTLIN_KEYWORD_OPERATOR_FUN .getAttributes()
50
+ operationSignTokenType is KtSingleValueToken -> KOTLIN_MATH_OPERATOR_FUN .getAttributes()
51
+ ! expr.isConventionOperator() -> KOTLIN_INFIX_FUN .getAttributes()
55
52
else -> null
56
53
}
57
54
}
@@ -61,4 +58,7 @@ private class KotlinAnnotator : Annotator {
61
58
textAttributes : TextAttributes ) {
62
59
createInfoAnnotation(element, null ).enforcedTextAttributes = textAttributes
63
60
}
61
+
62
+ private fun TextAttributesKey.getAttributes (): TextAttributes =
63
+ globalScheme.getAttributes(this )
64
64
}
0 commit comments