Implicit exhaustive when annotation / highlighting
This commit is contained in:
committed by
Mikhail Glukhikh
parent
7d6ccc40c2
commit
0cc09872b6
@@ -135,6 +135,7 @@ options.kotlin.attribute.descriptor.variable.as.function.like.call=Variable as f
|
||||
options.kotlin.attribute.descriptor.smart.cast=Smart-cast value
|
||||
options.kotlin.attribute.descriptor.smart.constant=Smart constant
|
||||
options.kotlin.attribute.descriptor.smart.cast.receiver=Smart-cast implicit receiver
|
||||
options.kotlin.attribute.descriptor.implicit.exhaustive.when=Implicitly exhaustive when
|
||||
options.kotlin.attribute.descriptor.label=Label
|
||||
change.to.function.invocation=Change to function invocation
|
||||
migrate.sure=Replace sure() calls by !! in project
|
||||
|
||||
+1
@@ -85,6 +85,7 @@ public class KotlinHighlightingColors {
|
||||
public static final TextAttributesKey SMART_CAST_VALUE = createTextAttributesKey("KOTLIN_SMART_CAST_VALUE");
|
||||
public static final TextAttributesKey SMART_CONSTANT = createTextAttributesKey("KOTLIN_SMART_CONSTANT");
|
||||
public static final TextAttributesKey SMART_CAST_RECEIVER = createTextAttributesKey("KOTLIN_SMART_CAST_RECEIVER");
|
||||
public static final TextAttributesKey IMPLICIT_EXHAUSTIVE_WHEN = createTextAttributesKey("KOTLIN_IMPLICIT_EXHAUSTIVE_WHEN");
|
||||
public static final TextAttributesKey LABEL = createTextAttributesKey("KOTLIN_LABEL");
|
||||
public static final TextAttributesKey DEBUG_INFO = createTextAttributesKey("KOTLIN_DEBUG_INFO");
|
||||
public static final TextAttributesKey RESOLVED_TO_ERROR = createTextAttributesKey("KOTLIN_RESOLVED_TO_ERROR");
|
||||
|
||||
+9
@@ -110,6 +110,15 @@ class VariablesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
.setTextAttributes(KotlinHighlightingColors.SMART_CAST_VALUE);
|
||||
}
|
||||
|
||||
if (expression instanceof KtWhenExpression) {
|
||||
KtWhenExpression whenExpression = (KtWhenExpression) expression;
|
||||
boolean implicitExhaustiveWhen = bindingContext.get(IMPLICIT_EXHAUSTIVE_WHEN, whenExpression) == Boolean.TRUE;
|
||||
if (implicitExhaustiveWhen) {
|
||||
holder.createInfoAnnotation(whenExpression.getWhenKeyword(), "When is implicitly exhaustive")
|
||||
.setTextAttributes(KotlinHighlightingColors.IMPLICIT_EXHAUSTIVE_WHEN);
|
||||
}
|
||||
}
|
||||
|
||||
super.visitExpression(expression);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user