Made proper tooltips for autocasted values and wrapped-in-a-ref values.

This commit is contained in:
Evgeny Gerashchenko
2012-04-02 17:38:23 +04:00
parent 09229a6f07
commit 2b72f4f7f9
@@ -23,6 +23,7 @@ import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.types.JetType; import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.resolve.DescriptorRenderer;
import static org.jetbrains.jet.lang.resolve.BindingContext.*; import static org.jetbrains.jet.lang.resolve.BindingContext.*;
@@ -70,7 +71,7 @@ class VariablesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
public void visitExpression(@NotNull JetExpression expression) { public void visitExpression(@NotNull JetExpression expression) {
JetType autoCast = bindingContext.get(AUTOCAST, expression); JetType autoCast = bindingContext.get(AUTOCAST, expression);
if (autoCast != null) { if (autoCast != null) {
holder.createInfoAnnotation(expression, "Automatically cast to " + autoCast).setTextAttributes( holder.createInfoAnnotation(expression, "Automatically cast to " + DescriptorRenderer.TEXT.renderType(autoCast)).setTextAttributes(
JetHighlightingColors.AUTO_CASTED_VALUE); JetHighlightingColors.AUTO_CASTED_VALUE);
} }
super.visitExpression(expression); super.visitExpression(expression);
@@ -97,7 +98,7 @@ class VariablesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
} }
if (Boolean.TRUE.equals(bindingContext.get(MUST_BE_WRAPPED_IN_A_REF, variableDescriptor))) { if (Boolean.TRUE.equals(bindingContext.get(MUST_BE_WRAPPED_IN_A_REF, variableDescriptor))) {
holder.createInfoAnnotation(elementToHighlight, "Wrapped into a ref-object to be modifier when captured in a closure").setTextAttributes( holder.createInfoAnnotation(elementToHighlight, "Wrapped into a reference object to be modified when captured in a closure").setTextAttributes(
JetHighlightingColors.WRAPPED_INTO_REF); JetHighlightingColors.WRAPPED_INTO_REF);
} }