Moved all text attribute keys from JetHighlighter to JetHighlightingColors, changing their colors.

This commit is contained in:
Evgeny Gerashchenko
2012-03-23 00:19:34 +04:00
parent fc236f93e5
commit ea7962a81a
7 changed files with 161 additions and 156 deletions
@@ -119,13 +119,13 @@ public class DebugInfoAnnotator implements Annotator {
boolean unresolved = unresolvedReferences.contains(expression);
JetType expressionType = bindingContext.get(EXPRESSION_TYPE, expression);
if (declarationDescriptor != null && !ApplicationManager.getApplication().isUnitTestMode() && (ErrorUtils.isError(declarationDescriptor) || ErrorUtils.containsErrorType(expressionType))) {
holder.createErrorAnnotation(expression, "[DEBUG] Resolved to error element").setTextAttributes(JetHighlighter.JET_RESOLVED_TO_ERROR);
holder.createErrorAnnotation(expression, "[DEBUG] Resolved to error element").setTextAttributes(JetHighlightingColors.RESOLVED_TO_ERROR);
}
if (resolved && unresolved) {
holder.createErrorAnnotation(expression, "[DEBUG] Reference marked as unresolved is actually resolved to " + target).setTextAttributes(JetHighlighter.JET_DEBUG_INFO);
holder.createErrorAnnotation(expression, "[DEBUG] Reference marked as unresolved is actually resolved to " + target).setTextAttributes(JetHighlightingColors.DEBUG_INFO);
}
else if (!resolved && !unresolved) {
holder.createErrorAnnotation(expression, "[DEBUG] Reference is not resolved to anything, but is not marked unresolved").setTextAttributes(JetHighlighter.JET_DEBUG_INFO);
holder.createErrorAnnotation(expression, "[DEBUG] Reference is not resolved to anything, but is not marked unresolved").setTextAttributes(JetHighlightingColors.DEBUG_INFO);
}
}
@@ -18,6 +18,7 @@ package org.jetbrains.jet.plugin.highlighter;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.openapi.options.OptionsBundle;
import com.intellij.openapi.options.colors.AttributesDescriptor;
import com.intellij.openapi.options.colors.ColorDescriptor;
import com.intellij.openapi.options.colors.ColorSettingsPage;
@@ -94,8 +95,32 @@ public class JetColorSettingsPage implements ColorSettingsPage {
@NotNull
@Override
public AttributesDescriptor[] getAttributeDescriptors() {
// TODO i18n
return new AttributesDescriptor[]{
new AttributesDescriptor(JetHighlightingColors.JET_KEYWORD.getExternalName(), JetHighlightingColors.JET_KEYWORD)
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.keyword"), JetHighlightingColors.KEYWORD),
new AttributesDescriptor("Soft keyword", JetHighlightingColors.SOFT_KEYWORD),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.number"), JetHighlightingColors.NUMBER),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.string"), JetHighlightingColors.STRING),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.valid.escape.in.string"), JetHighlightingColors.VALID_STRING_ESCAPE),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.line.comment"), JetHighlightingColors.LINE_COMMENT),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.block.comment"), JetHighlightingColors.BLOCK_COMMENT),
new AttributesDescriptor("KDoc comment", JetHighlightingColors.DOC_COMMENT),
new AttributesDescriptor("Wrapped into ref", JetHighlightingColors.WRAPPED_INTO_REF),
new AttributesDescriptor("Instance property with backing field", JetHighlightingColors.INSTANCE_PROPERTY_WITH_BACKING_FIELD),
new AttributesDescriptor("Instance property backing field access", JetHighlightingColors.INSTANCE_BACKING_FIELD_ACCESS),
new AttributesDescriptor("Function literal default parameter", JetHighlightingColors.FUNCTION_LITERAL_DEFAULT_PARAMETER),
new AttributesDescriptor("Function literal bracket", JetHighlightingColors.FUNCTION_LITERAL_BRACKET),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.bad.character"), JetHighlightingColors.BAD_CHARACTER),
new AttributesDescriptor("Automatically casted value", JetHighlightingColors.AUTO_CASTED_VALUE),
new AttributesDescriptor("Label", JetHighlightingColors.LABEL),
};
}
@@ -20,20 +20,14 @@
package org.jetbrains.jet.plugin.highlighter;
import com.intellij.lexer.Lexer;
import com.intellij.openapi.editor.HighlighterColors;
import com.intellij.openapi.editor.SyntaxHighlighterColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.editor.markup.EffectType;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
import com.intellij.psi.TokenType;
import com.intellij.psi.tree.IElementType;
import com.intellij.ui.Colors;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lexer.JetLexer;
import org.jetbrains.jet.lexer.JetTokens;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
@@ -41,118 +35,6 @@ public class JetHighlighter extends SyntaxHighlighterBase {
private static final Map<IElementType, TextAttributesKey> keys1;
private static final Map<IElementType, TextAttributesKey> keys2;
public static final TextAttributesKey JET_SOFT_KEYWORD;
static {
TextAttributes attributes = SyntaxHighlighterColors.KEYWORD.getDefaultAttributes().clone();
attributes.setForegroundColor(Colors.DARK_RED);
JET_SOFT_KEYWORD = TextAttributesKey.createTextAttributesKey(
"JET.SOFT.KEYWORD",
attributes
);
}
public static final TextAttributesKey JET_FIELD_IDENTIFIER = TextAttributesKey.createTextAttributesKey(
"JET.FIELD.IDENTIFIER",
// TODO: proper attributes
SyntaxHighlighterColors.NUMBER.getDefaultAttributes()
);
public static final TextAttributesKey JET_PROPERTY_WITH_BACKING_FIELD_IDENTIFIER = TextAttributesKey.createTextAttributesKey(
"JET.PROPERTY.WITH.BACKING.FIELD.IDENTIFIER",
// TODO: proper attributes
SyntaxHighlighterColors.NUMBER.getDefaultAttributes()
);
public static final TextAttributesKey JET_LABEL_IDENTIFIER = TextAttributesKey.createTextAttributesKey(
"JET.LABEL.IDENTIFIER",
// TODO: proper attributes
SyntaxHighlighterColors.NUMBER.getDefaultAttributes()
);
private static final TextAttributesKey JET_NUMBER = TextAttributesKey.createTextAttributesKey(
"JET.NUMBER",
SyntaxHighlighterColors.NUMBER.getDefaultAttributes()
);
public static final TextAttributesKey JET_STRING = TextAttributesKey.createTextAttributesKey(
"JET.STRING",
SyntaxHighlighterColors.STRING.getDefaultAttributes()
);
public static final TextAttributesKey JET_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey(
"JET.STRING.ESCAPE",
SyntaxHighlighterColors.VALID_STRING_ESCAPE.getDefaultAttributes()
);
private static final TextAttributesKey JET_COMMENT;
static {
TextAttributes attributes = SyntaxHighlighterColors.LINE_COMMENT.getDefaultAttributes().clone();
attributes.setFontType(Font.PLAIN);
JET_COMMENT = TextAttributesKey.createTextAttributesKey(
"JET.COMMENT",
attributes
);
}
private static final TextAttributesKey JET_BAD_CHARACTER = TextAttributesKey.createTextAttributesKey(
"JET.BADCHARACTER",
HighlighterColors.BAD_CHARACTER.getDefaultAttributes()
);
public static final TextAttributesKey JET_AUTO_CAST_EXPRESSION;
static {
TextAttributes clone = SyntaxHighlighterColors.STRING.getDefaultAttributes().clone();
clone.setFontType(Font.PLAIN);
// TODO: proper attributes
JET_AUTO_CAST_EXPRESSION = TextAttributesKey.createTextAttributesKey("JET.AUTO.CAST.EXPRESSION", clone);
}
public static final TextAttributesKey JET_WRAPPED_INTO_REF;
static {
TextAttributes attributes = new TextAttributes();
attributes.setEffectType(EffectType.LINE_UNDERSCORE);
attributes.setEffectColor(Color.BLACK);
JET_WRAPPED_INTO_REF = TextAttributesKey.createTextAttributesKey("JET.WRAPPED.INTO.REF", attributes);
}
public static final TextAttributesKey JET_AUTOCREATED_IT;
static {
TextAttributes attributes = new TextAttributes();
attributes.setFontType(Font.BOLD);
// TODO: proper attributes
JET_AUTOCREATED_IT = TextAttributesKey.createTextAttributesKey("JET.AUTO.CREATED.IT", attributes);
}
public static final TextAttributesKey JET_FUNCTION_LITERAL_DELIMITER;
static {
TextAttributes attributes = new TextAttributes();
attributes.setFontType(Font.BOLD);
// TODO: proper attributes
JET_FUNCTION_LITERAL_DELIMITER = TextAttributesKey.createTextAttributesKey("JET.AUTO.CREATED.IT", attributes);
}
public static final TextAttributesKey JET_DEBUG_INFO;
static {
TextAttributes textAttributes = new TextAttributes();
textAttributes.setEffectType(EffectType.ROUNDED_BOX);
textAttributes.setEffectColor(Color.BLACK);
JET_DEBUG_INFO = TextAttributesKey.createTextAttributesKey("JET.DEBUG.INFO", textAttributes);
}
public static final TextAttributesKey JET_RESOLVED_TO_ERROR;
static {
TextAttributes textAttributes = new TextAttributes();
textAttributes.setEffectType(EffectType.ROUNDED_BOX);
textAttributes.setEffectColor(Color.RED);
JET_RESOLVED_TO_ERROR = TextAttributesKey.createTextAttributesKey("JET.RESOLVED.TO.ERROR", textAttributes);
}
@NotNull
public Lexer getHighlightingLexer() {
return new JetLexer();
@@ -168,30 +50,30 @@ public class JetHighlighter extends SyntaxHighlighterBase {
keys2 = new HashMap<IElementType, TextAttributesKey>();
fillMap(keys1, JetTokens.KEYWORDS, JetHighlightingColors.JET_KEYWORD);
fillMap(keys1, JetTokens.KEYWORDS, JetHighlightingColors.KEYWORD);
keys1.put(JetTokens.AS_SAFE, JetHighlightingColors.JET_KEYWORD);
keys1.put(JetTokens.LABEL_IDENTIFIER, JET_LABEL_IDENTIFIER);
keys1.put(JetTokens.ATAT, JET_LABEL_IDENTIFIER);
keys1.put(JetTokens.FIELD_IDENTIFIER, JET_FIELD_IDENTIFIER);
keys1.put(JetTokens.INTEGER_LITERAL, JET_NUMBER);
keys1.put(JetTokens.FLOAT_LITERAL, JET_NUMBER);
keys1.put(JetTokens.AS_SAFE, JetHighlightingColors.KEYWORD);
keys1.put(JetTokens.LABEL_IDENTIFIER, JetHighlightingColors.LABEL);
keys1.put(JetTokens.ATAT, JetHighlightingColors.LABEL);
keys1.put(JetTokens.FIELD_IDENTIFIER, JetHighlightingColors.INSTANCE_BACKING_FIELD_ACCESS);
keys1.put(JetTokens.INTEGER_LITERAL, JetHighlightingColors.NUMBER);
keys1.put(JetTokens.FLOAT_LITERAL, JetHighlightingColors.NUMBER);
keys1.put(JetTokens.OPEN_QUOTE, JET_STRING);
keys1.put(JetTokens.CLOSING_QUOTE, JET_STRING);
keys1.put(JetTokens.REGULAR_STRING_PART, JET_STRING);
keys1.put(JetTokens.LONG_TEMPLATE_ENTRY_END, JET_STRING_ESCAPE);
keys1.put(JetTokens.LONG_TEMPLATE_ENTRY_START, JET_STRING_ESCAPE);
keys1.put(JetTokens.SHORT_TEMPLATE_ENTRY_START, JET_STRING_ESCAPE);
keys1.put(JetTokens.OPEN_QUOTE, JetHighlightingColors.STRING);
keys1.put(JetTokens.CLOSING_QUOTE, JetHighlightingColors.STRING);
keys1.put(JetTokens.REGULAR_STRING_PART, JetHighlightingColors.STRING);
keys1.put(JetTokens.LONG_TEMPLATE_ENTRY_END, JetHighlightingColors.VALID_STRING_ESCAPE);
keys1.put(JetTokens.LONG_TEMPLATE_ENTRY_START, JetHighlightingColors.VALID_STRING_ESCAPE);
keys1.put(JetTokens.SHORT_TEMPLATE_ENTRY_START, JetHighlightingColors.VALID_STRING_ESCAPE);
keys1.put(JetTokens.ESCAPE_SEQUENCE, JET_STRING_ESCAPE);
keys1.put(JetTokens.ESCAPE_SEQUENCE, JetHighlightingColors.VALID_STRING_ESCAPE);
keys1.put(JetTokens.CHARACTER_LITERAL, JET_STRING);
keys1.put(JetTokens.CHARACTER_LITERAL, JetHighlightingColors.STRING);
keys1.put(JetTokens.EOL_COMMENT, JET_COMMENT);
keys1.put(JetTokens.BLOCK_COMMENT, JET_COMMENT);
keys1.put(JetTokens.DOC_COMMENT, JET_COMMENT);
keys1.put(JetTokens.EOL_COMMENT, JetHighlightingColors.LINE_COMMENT);
keys1.put(JetTokens.BLOCK_COMMENT, JetHighlightingColors.BLOCK_COMMENT);
keys1.put(JetTokens.DOC_COMMENT, JetHighlightingColors.DOC_COMMENT);
keys1.put(TokenType.BAD_CHARACTER, JET_BAD_CHARACTER);
keys1.put(TokenType.BAD_CHARACTER, JetHighlightingColors.BAD_CHARACTER);
}
}
@@ -16,15 +16,113 @@
package org.jetbrains.jet.plugin.highlighter;
import com.intellij.openapi.editor.HighlighterColors;
import com.intellij.openapi.editor.SyntaxHighlighterColors;
import com.intellij.openapi.editor.colors.CodeInsightColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.editor.markup.EffectType;
import com.intellij.openapi.editor.markup.TextAttributes;
import java.awt.*;
public class JetHighlightingColors {
public final static TextAttributesKey JET_KEYWORD = TextAttributesKey.createTextAttributesKey(
"Keyword",
public final static TextAttributesKey KEYWORD = TextAttributesKey.createTextAttributesKey(
"KOTLIN_KEYWORD",
SyntaxHighlighterColors.KEYWORD.getDefaultAttributes()
);
public static final TextAttributesKey SOFT_KEYWORD;
static {
TextAttributes attributes = SyntaxHighlighterColors.KEYWORD.getDefaultAttributes().clone();
attributes.setFontType(Font.PLAIN);
SOFT_KEYWORD = TextAttributesKey.createTextAttributesKey(
"KOTLIN_SOFT_KEYWORD",
attributes
);
}
public static final TextAttributesKey NUMBER = TextAttributesKey.createTextAttributesKey(
"KOTLIN_NUMBER",
SyntaxHighlighterColors.NUMBER.getDefaultAttributes()
);
public static final TextAttributesKey STRING = TextAttributesKey.createTextAttributesKey(
"KOTLIN_STRING",
SyntaxHighlighterColors.STRING.getDefaultAttributes()
);
public static final TextAttributesKey VALID_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey(
"KOTLIN_VALID_STRING_ESCAPE",
SyntaxHighlighterColors.VALID_STRING_ESCAPE.getDefaultAttributes()
);
public static final TextAttributesKey LINE_COMMENT = TextAttributesKey.createTextAttributesKey(
"KOTLIN_LINE_COMMENT",
SyntaxHighlighterColors.LINE_COMMENT.getDefaultAttributes()
);
public static final TextAttributesKey BLOCK_COMMENT = TextAttributesKey.createTextAttributesKey(
"KOTLIN_BLOCK_COMMENT",
SyntaxHighlighterColors.JAVA_BLOCK_COMMENT.getDefaultAttributes()
);
public static final TextAttributesKey DOC_COMMENT = TextAttributesKey.createTextAttributesKey(
"KOTLIN_DOC_COMMENT",
SyntaxHighlighterColors.DOC_COMMENT.getDefaultAttributes()
);
// TODO review: is it needed?
public static final TextAttributesKey WRAPPED_INTO_REF = TextAttributesKey.createTextAttributesKey(
"KOTLIN_WRAPPED_INTO_REF",
new TextAttributes(null, null, Color.BLACK, EffectType.LINE_UNDERSCORE, Font.PLAIN)
);
public static final TextAttributesKey INSTANCE_PROPERTY_WITH_BACKING_FIELD = TextAttributesKey.createTextAttributesKey(
"KOTLIN_INSTANCE_PROPERTY_WITH_BACKING_FIELD",
CodeInsightColors.INSTANCE_FIELD_ATTRIBUTES.getDefaultAttributes()
);
public static final TextAttributesKey INSTANCE_BACKING_FIELD_ACCESS = TextAttributesKey.createTextAttributesKey(
"KOTLIN_INSTANCE_BACKING_FIELD_ACCESS",
CodeInsightColors.INSTANCE_FIELD_ATTRIBUTES.getDefaultAttributes()
);
public static final TextAttributesKey FUNCTION_LITERAL_DEFAULT_PARAMETER = TextAttributesKey.createTextAttributesKey(
"KOTLIN_CLOSURE_DEFAULT_PARAMETER",
new TextAttributes(null, null, null, null, Font.BOLD)
);
public static final TextAttributesKey FUNCTION_LITERAL_BRACKET = TextAttributesKey.createTextAttributesKey(
"KOTLIN_FUNCTION_LITERAL_BRACKET",
new TextAttributes(null, null, null, null, Font.BOLD)
);
public static final TextAttributesKey BAD_CHARACTER = TextAttributesKey.createTextAttributesKey(
"KOTLIN_BAD_CHARACTER",
HighlighterColors.BAD_CHARACTER.getDefaultAttributes()
);
public static final TextAttributesKey AUTO_CASTED_VALUE = TextAttributesKey.createTextAttributesKey(
"KOTLIN_AUTO_CASTED_VALUE",
new TextAttributes(STRING.getDefaultAttributes().getForegroundColor(), null, null, null, Font.PLAIN)
);
public static final TextAttributesKey LABEL = TextAttributesKey.createTextAttributesKey(
"KOTLIN_LABEL",
new TextAttributes(new Color(74, 134, 232), null, null, null, Font.PLAIN)
);
public static final TextAttributesKey DEBUG_INFO = TextAttributesKey.createTextAttributesKey(
"KOTLIN_DEBUG_INFO",
new TextAttributes(null, null, Color.BLACK, EffectType.ROUNDED_BOX, Font.PLAIN)
);
public static final TextAttributesKey RESOLVED_TO_ERROR = TextAttributesKey.createTextAttributesKey(
"KOTLIN_RESOLVED_TO_ERROR",
new TextAttributes(null, null, Color.RED, EffectType.ROUNDED_BOX, Font.PLAIN)
);
private JetHighlightingColors() {
}
}
@@ -39,7 +39,6 @@ import org.jetbrains.jet.lang.diagnostics.*;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.plugin.highlighter.JetHighlighter;
import org.jetbrains.jet.plugin.compiler.WholeProjectAnalyzerFacade;
import org.jetbrains.jet.plugin.quickfix.JetIntentionActionFactory;
import org.jetbrains.jet.plugin.quickfix.QuickFixes;
@@ -94,7 +93,7 @@ public class JetPsiChecker implements Annotator {
if (target instanceof ValueParameterDescriptor) {
ValueParameterDescriptor parameterDescriptor = (ValueParameterDescriptor) target;
if (bindingContext.get(AUTO_CREATED_IT, parameterDescriptor)) {
holder.createInfoAnnotation(expression, "Automatically declared based on the expected type").setTextAttributes(JetHighlighter.JET_AUTOCREATED_IT);
holder.createInfoAnnotation(expression, "Automatically declared based on the expected type").setTextAttributes(JetHighlightingColors.FUNCTION_LITERAL_DEFAULT_PARAMETER);
}
}
@@ -106,7 +105,8 @@ public class JetPsiChecker implements Annotator {
if (target instanceof VariableDescriptor) {
VariableDescriptor variableDescriptor = (VariableDescriptor) target;
if (bindingContext.get(MUST_BE_WRAPPED_IN_A_REF, variableDescriptor)) {
holder.createInfoAnnotation(node, "Wrapped into a ref-object to be modifier when captured in a closure").setTextAttributes(JetHighlighter.JET_WRAPPED_INTO_REF);
holder.createInfoAnnotation(node, "Wrapped into a ref-object to be modifier when captured in a closure").setTextAttributes(
JetHighlightingColors.WRAPPED_INTO_REF);
}
}
@@ -126,7 +126,8 @@ public class JetPsiChecker implements Annotator {
public void visitExpression(@NotNull JetExpression expression) {
JetType autoCast = bindingContext.get(AUTOCAST, expression);
if (autoCast != null) {
holder.createInfoAnnotation(expression, "Automatically cast to " + autoCast).setTextAttributes(JetHighlighter.JET_AUTO_CAST_EXPRESSION);
holder.createInfoAnnotation(expression, "Automatically cast to " + autoCast).setTextAttributes(
JetHighlightingColors.AUTO_CASTED_VALUE);
}
expression.acceptChildren(this);
}
@@ -295,7 +296,7 @@ public class JetPsiChecker implements Annotator {
holder.createInfoAnnotation(
nameIdentifier,
"This property has a backing field")
.setTextAttributes(JetHighlighter.JET_PROPERTY_WITH_BACKING_FIELD_IDENTIFIER);
.setTextAttributes(JetHighlightingColors.INSTANCE_PROPERTY_WITH_BACKING_FIELD);
}
}
}
@@ -28,7 +28,6 @@ import org.jetbrains.jet.lang.psi.JetPrefixExpression;
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
import org.jetbrains.jet.lang.psi.JetVisitorVoid;
import org.jetbrains.jet.lexer.JetTokens;
import org.jetbrains.jet.plugin.highlighter.JetHighlighter;
public class LabelsAnnotator implements Annotator {
public void annotate(@NotNull PsiElement element, @NotNull final AnnotationHolder holder) {
@@ -38,7 +37,7 @@ public class LabelsAnnotator implements Annotator {
public void visitPrefixExpression(JetPrefixExpression expression) {
JetSimpleNameExpression operationSign = expression.getOperationReference();
if (JetTokens.LABELS.contains(operationSign.getReferencedNameElementType())) {
holder.createInfoAnnotation(operationSign, null).setTextAttributes(JetHighlighter.JET_LABEL_IDENTIFIER);
holder.createInfoAnnotation(operationSign, null).setTextAttributes(JetHighlightingColors.LABEL);
}
}
@@ -46,7 +45,7 @@ public class LabelsAnnotator implements Annotator {
public void visitLabelQualifiedExpression(JetLabelQualifiedExpression expression) {
JetSimpleNameExpression targetLabel = expression.getTargetLabel();
if (targetLabel != null) {
holder.createInfoAnnotation(targetLabel, null).setTextAttributes(JetHighlighter.JET_LABEL_IDENTIFIER);
holder.createInfoAnnotation(targetLabel, null).setTextAttributes(JetHighlightingColors.LABEL);
}
}
@@ -36,7 +36,7 @@ public class SoftKeywordsAnnotator implements Annotator {
public void visitElement(PsiElement element) {
if (element instanceof LeafPsiElement) {
if (JetTokens.SOFT_KEYWORDS.contains(((LeafPsiElement) element).getElementType())) {
holder.createInfoAnnotation(element, null).setTextAttributes(JetHighlighter.JET_SOFT_KEYWORD);
holder.createInfoAnnotation(element, null).setTextAttributes(JetHighlightingColors.SOFT_KEYWORD);
}
}
}
@@ -54,14 +54,14 @@ public class SoftKeywordsAnnotator implements Annotator {
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) {
if (ApplicationManager.getApplication().isUnitTestMode()) return;
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
holder.createInfoAnnotation(functionLiteral.getOpenBraceNode(), null).setTextAttributes(JetHighlighter.JET_FUNCTION_LITERAL_DELIMITER);
holder.createInfoAnnotation(functionLiteral.getOpenBraceNode(), null).setTextAttributes(JetHighlightingColors.FUNCTION_LITERAL_BRACKET);
ASTNode closingBraceNode = functionLiteral.getClosingBraceNode();
if (closingBraceNode != null) {
holder.createInfoAnnotation(closingBraceNode, null).setTextAttributes(JetHighlighter.JET_FUNCTION_LITERAL_DELIMITER);
holder.createInfoAnnotation(closingBraceNode, null).setTextAttributes(JetHighlightingColors.FUNCTION_LITERAL_BRACKET);
}
ASTNode arrowNode = functionLiteral.getArrowNode();
if (arrowNode != null) {
holder.createInfoAnnotation(arrowNode, null).setTextAttributes(JetHighlighter.JET_FUNCTION_LITERAL_DELIMITER);
holder.createInfoAnnotation(arrowNode, null).setTextAttributes(JetHighlightingColors.FUNCTION_LITERAL_BRACKET);
}
}
});
@@ -73,7 +73,7 @@ public class SoftKeywordsAnnotator implements Annotator {
if (userType.getQualifier() == null) {
JetSimpleNameExpression referenceExpression = userType.getReferenceExpression();
if (referenceExpression != null) {
holder.createInfoAnnotation(referenceExpression.getNode(), "Annotation").setTextAttributes(JetHighlighter.JET_SOFT_KEYWORD);
holder.createInfoAnnotation(referenceExpression.getNode(), "Annotation").setTextAttributes(JetHighlightingColors.SOFT_KEYWORD);
}
}
}