Groovy Colors: employ language defaults

This commit is contained in:
Gregory.Shrago
2015-02-12 21:53:39 +03:00
parent 949fd4dbf0
commit 5d6fddca9d
16 changed files with 263 additions and 397 deletions
@@ -1730,31 +1730,6 @@
<option name="EFFECT_TYPE" value="-1" />
</value>
</option>
<option name="GROOVY_KEYWORD">
<value>
<option name="FOREGROUND" value="cc7832" />
</value>
</option>
<option name="GString">
<value>
<option name="FOREGROUND" value="6a8759" />
</value>
</option>
<option name="Groovy method declaration">
<value />
</option>
<option name="Groovydoc comment">
<value>
<option name="FOREGROUND" value="629755" />
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="Groovydoc tag">
<value>
<option name="FOREGROUND" value="7cb36f" />
<option name="EFFECT_TYPE" value="1" />
</value>
</option>
<option name="HAML_CLASS">
<value>
<option name="FOREGROUND" value="e8bf6a" />
@@ -2095,12 +2070,6 @@
<option name="FOREGROUND" value="ff6b68" />
</value>
</option>
<option name="List/map to object conversion">
<value>
<option name="FOREGROUND" value="e8bf6a" />
<option name="FONT_TYPE" value="1" />
</value>
</option>
<option name="MATCHED_BRACE_ATTRIBUTES">
<value>
<option name="FOREGROUND" value="ffef28" />
@@ -2494,12 +2463,6 @@
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="Static property reference ID">
<value>
<option name="FOREGROUND" value="9876aa" />
<option name="FONT_TYPE" value="2" />
</value>
</option>
<option name="String">
<value>
<option name="FOREGROUND" value="6a8759" />
@@ -2574,13 +2537,6 @@
<option name="FOREGROUND" value="d1243b" />
</value>
</option>
<option name="Unresolved reference access">
<value>
<option name="FOREGROUND" value="808080" />
<option name="EFFECT_COLOR" value="808080" />
<option name="EFFECT_TYPE" value="1" />
</value>
</option>
<option name="VELOCITY_DIRECTIVE">
<value>
<option name="FOREGROUND" value="e8bf6a" />
@@ -32,7 +32,7 @@ import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
import static org.jetbrains.plugins.gradle.service.resolve.GradleResolverUtil.canBeMethodOf;
import static org.jetbrains.plugins.groovy.highlighter.DefaultHighlighter.MAP_KEY;
import static org.jetbrains.plugins.groovy.highlighter.GroovySyntaxHighlighter.MAP_KEY;
/**
* @author Vladislav.Soroka
+2 -3
View File
@@ -4,8 +4,8 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
@@ -26,5 +26,4 @@
<orderEntry type="module" module-name="properties-psi-impl" />
<orderEntry type="module" module-name="properties-psi-api" />
</component>
</module>
</module>
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<list>
<option name="GROOVY_KEYWORD">
<value>
<option name="FOREGROUND" value="cc7832"/>
</value>
</option>
<option name="GString">
<value>
<option name="FOREGROUND" value="6a8759"/>
</value>
</option>
<option name="Groovy method declaration">
<value/>
</option>
<option name="Groovydoc comment">
<value>
<option name="FOREGROUND" value="629755"/>
<option name="FONT_TYPE" value="2"/>
</value>
</option>
<option name="Groovydoc tag">
<value>
<option name="FOREGROUND" value="7cb36f"/>
<option name="EFFECT_TYPE" value="1"/>
</value>
</option>
<option name="Unresolved reference access">
<value>
<option name="FOREGROUND" value="808080"/>
<option name="EFFECT_COLOR" value="808080"/>
<option name="EFFECT_TYPE" value="1"/>
</value>
</option>
<option name="Static property reference ID">
<value>
<option name="FOREGROUND" value="9876aa"/>
<option name="FONT_TYPE" value="2"/>
</value>
</option>
<option name="List/map to object conversion">
<value>
<option name="FOREGROUND" value="e8bf6a"/>
<option name="FONT_TYPE" value="1"/>
</value>
</option>
</list>
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<list>
<option name="GROOVY_KEYWORD">
<value>
<option name="FOREGROUND" value="000043"/>
<option name="FONT_TYPE" value="1"/>
</value>
</option>
<option name="Instance property reference ID">
<value>
<option name="FONT_TYPE" value="0"/>
</value>
</option>
<option name="Static property reference ID">
<value>
<option name="FONT_TYPE" value="2"/>
</value>
</option>
<option name="Unresolved reference access">
<value>
<option name="FOREGROUND" value="000000"/>
<option name="EFFECT_TYPE" value="1"/>
<option name="EFFECT_COLOR" value="808080"/>
</value>
</option>
<option name="List/map to object conversion">
<value>
<option name="FOREGROUND" value="0000ff"/>
<option name="FONT_TYPE" value="1"/>
</value>
</option>
<option name="Map key">
<value>
<option name="FOREGROUND" value="008000"/>
<option name="FONT_TYPE" value="0"/>
</value>
</option>
</list>
@@ -29,7 +29,7 @@ import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.highlighter.DefaultHighlighter;
import org.jetbrains.plugins.groovy.highlighter.GroovySyntaxHighlighter;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
@@ -123,11 +123,11 @@ public class GrHighlightUtil {
if (resolved instanceof PsiField || resolved instanceof GrVariable && ResolveUtil.isScriptField((GrVariable)resolved)) {
boolean isStatic = ((PsiVariable)resolved).hasModifierProperty(PsiModifier.STATIC);
return isStatic ? DefaultHighlighter.STATIC_FIELD : DefaultHighlighter.INSTANCE_FIELD;
return isStatic ? GroovySyntaxHighlighter.STATIC_FIELD : GroovySyntaxHighlighter.INSTANCE_FIELD;
}
else if (resolved instanceof GrAccessorMethod) {
boolean isStatic = ((GrAccessorMethod)resolved).hasModifierProperty(PsiModifier.STATIC);
return isStatic ? DefaultHighlighter.STATIC_PROPERTY_REFERENCE : DefaultHighlighter.INSTANCE_PROPERTY_REFERENCE;
return isStatic ? GroovySyntaxHighlighter.STATIC_PROPERTY_REFERENCE : GroovySyntaxHighlighter.INSTANCE_PROPERTY_REFERENCE;
}
else if (resolved instanceof PsiMethod) {
@@ -140,49 +140,49 @@ public class GrHighlightUtil {
return null;
}
else {
return DefaultHighlighter.CONSTRUCTOR_CALL;
return GroovySyntaxHighlighter.CONSTRUCTOR_CALL;
}
}
else {
return DefaultHighlighter.CONSTRUCTOR_DECLARATION;
return GroovySyntaxHighlighter.CONSTRUCTOR_DECLARATION;
}
}
else {
boolean isStatic = ((PsiMethod)resolved).hasModifierProperty(PsiModifier.STATIC);
if (GroovyPropertyUtils.isSimplePropertyAccessor((PsiMethod)resolved)) {
return isStatic ? DefaultHighlighter.STATIC_PROPERTY_REFERENCE : DefaultHighlighter.INSTANCE_PROPERTY_REFERENCE;
return isStatic ? GroovySyntaxHighlighter.STATIC_PROPERTY_REFERENCE : GroovySyntaxHighlighter.INSTANCE_PROPERTY_REFERENCE;
}
else {
if (refElement != null) {
return isStatic ? DefaultHighlighter.STATIC_METHOD_ACCESS : DefaultHighlighter.METHOD_CALL;
return isStatic ? GroovySyntaxHighlighter.STATIC_METHOD_ACCESS : GroovySyntaxHighlighter.METHOD_CALL;
}
else {
return DefaultHighlighter.METHOD_DECLARATION;
return GroovySyntaxHighlighter.METHOD_DECLARATION;
}
}
}
}
else if (resolved instanceof PsiTypeParameter) {
return DefaultHighlighter.TYPE_PARAMETER;
return GroovySyntaxHighlighter.TYPE_PARAMETER;
}
else if (resolved instanceof PsiClass) {
if (((PsiClass)resolved).isAnnotationType()) {
return DefaultHighlighter.ANNOTATION;
return GroovySyntaxHighlighter.ANNOTATION;
}
else {
return DefaultHighlighter.CLASS_REFERENCE;
return GroovySyntaxHighlighter.CLASS_REFERENCE;
}
}
else if (resolved instanceof GrParameter) {
boolean reassigned = isReassigned((GrParameter)resolved);
return reassigned ? DefaultHighlighter.REASSIGNED_PARAMETER : DefaultHighlighter.PARAMETER;
return reassigned ? GroovySyntaxHighlighter.REASSIGNED_PARAMETER : GroovySyntaxHighlighter.PARAMETER;
}
else if (resolved instanceof GrVariable) {
boolean reassigned = isReassigned((GrVariable)resolved);
return reassigned ? DefaultHighlighter.REASSIGNED_LOCAL_VARIABLE : DefaultHighlighter.LOCAL_VARIABLE;
return reassigned ? GroovySyntaxHighlighter.REASSIGNED_LOCAL_VARIABLE : GroovySyntaxHighlighter.LOCAL_VARIABLE;
}
else if (resolved instanceof GrLabeledStatement) {
return DefaultHighlighter.LABEL;
return GroovySyntaxHighlighter.LABEL;
}
return null;
}
@@ -30,7 +30,7 @@ import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.highlighter.DefaultHighlighter;
import org.jetbrains.plugins.groovy.highlighter.GroovySyntaxHighlighter;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
import org.jetbrains.plugins.groovy.lang.psi.GrNamedElement;
@@ -69,7 +69,7 @@ public class GrKeywordAndDeclarationHighlighter extends TextEditorHighlightingPa
IElementType tokenType = element.getNode().getElementType();
if (TokenSets.KEYWORDS.contains(tokenType)) {
if (highlightKeyword(element, tokenType)) {
addInfo(element, DefaultHighlighter.KEYWORD);
addInfo(element, GroovySyntaxHighlighter.KEYWORD);
}
}
else if (!(element instanceof GroovyPsiElement || element instanceof PsiErrorElement)) {
@@ -127,7 +127,7 @@ public class GrKeywordAndDeclarationHighlighter extends TextEditorHighlightingPa
@Nullable
private static TextAttributesKey getDeclarationAttribute(PsiElement element) {
if (element.getParent() instanceof GrAnnotation && element.getNode().getElementType() == GroovyTokenTypes.mAT) {
return DefaultHighlighter.ANNOTATION;
return GroovySyntaxHighlighter.ANNOTATION;
}
PsiElement parent = element.getParent();
@@ -59,7 +59,7 @@ import org.jetbrains.plugins.groovy.annotator.intentions.*;
import org.jetbrains.plugins.groovy.codeInspection.bugs.GrModifierFix;
import org.jetbrains.plugins.groovy.config.GroovyConfigUtils;
import org.jetbrains.plugins.groovy.findUsages.LiteralConstructorReference;
import org.jetbrains.plugins.groovy.highlighter.DefaultHighlighter;
import org.jetbrains.plugins.groovy.highlighter.GroovySyntaxHighlighter;
import org.jetbrains.plugins.groovy.lang.documentation.GroovyPresentationUtil;
import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocComment;
import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocReferenceElement;
@@ -328,12 +328,12 @@ public class GroovyAnnotator extends GroovyElementVisitor {
if (ResolveUtil.isKeyOfMap(referenceExpression)) {
PsiElement nameElement = referenceExpression.getReferenceNameElement();
LOG.assertTrue(nameElement != null);
myHolder.createInfoAnnotation(nameElement, null).setTextAttributes(DefaultHighlighter.MAP_KEY);
myHolder.createInfoAnnotation(nameElement, null).setTextAttributes(GroovySyntaxHighlighter.MAP_KEY);
}
else if (ResolveUtil.isClassReference(referenceExpression)) {
PsiElement nameElement = referenceExpression.getReferenceNameElement();
LOG.assertTrue(nameElement != null);
myHolder.createInfoAnnotation(nameElement, null).setTextAttributes(DefaultHighlighter.KEYWORD);
myHolder.createInfoAnnotation(nameElement, null).setTextAttributes(GroovySyntaxHighlighter.KEYWORD);
}
}
@@ -886,11 +886,11 @@ public class GroovyAnnotator extends GroovyElementVisitor {
((LiteralConstructorReference)constructorReference).getConstructedClassType() != null) {
final PsiElement startToken = listOrMap.getFirstChild();
if (startToken != null && startToken.getNode().getElementType() == GroovyTokenTypes.mLBRACK) {
myHolder.createInfoAnnotation(startToken, null).setTextAttributes(DefaultHighlighter.LITERAL_CONVERSION);
myHolder.createInfoAnnotation(startToken, null).setTextAttributes(GroovySyntaxHighlighter.LITERAL_CONVERSION);
}
final PsiElement endToken = listOrMap.getLastChild();
if (endToken != null && endToken.getNode().getElementType() == GroovyTokenTypes.mRBRACK) {
myHolder.createInfoAnnotation(endToken, null).setTextAttributes(DefaultHighlighter.LITERAL_CONVERSION);
myHolder.createInfoAnnotation(endToken, null).setTextAttributes(GroovySyntaxHighlighter.LITERAL_CONVERSION);
}
}
@@ -925,7 +925,7 @@ public class GroovyAnnotator extends GroovyElementVisitor {
(((PsiClass)resolved).isAnnotationType() ||
GrAnnotationCollector.findAnnotationCollector((PsiClass)resolved) != null &&
refElement.getParent() instanceof GrAnnotation)) {
myHolder.createInfoAnnotation(refElement, null).setTextAttributes(DefaultHighlighter.ANNOTATION);
myHolder.createInfoAnnotation(refElement, null).setTextAttributes(GroovySyntaxHighlighter.ANNOTATION);
}
}
@@ -1170,7 +1170,7 @@ public class GroovyAnnotator extends GroovyElementVisitor {
for (GrNamedArgument namedArgument : namedArguments) {
final GrArgumentLabel label = namedArgument.getLabel();
if (label != null && label.getExpression() == null && label.getNameElement().getNode().getElementType() != GroovyTokenTypes.mSTAR) {
myHolder.createInfoAnnotation(label, null).setTextAttributes(DefaultHighlighter.MAP_KEY);
myHolder.createInfoAnnotation(label, null).setTextAttributes(GroovySyntaxHighlighter.MAP_KEY);
}
}
}
@@ -1707,7 +1707,7 @@ public class GroovyAnnotator extends GroovyElementVisitor {
return ref.getManager().areElementsEquivalent(type.resolve(), resolved);
}
}) != null) {
holder.createInfoAnnotation(nameElement, null).setTextAttributes(DefaultHighlighter.KEYWORD);
holder.createInfoAnnotation(nameElement, null).setTextAttributes(GroovySyntaxHighlighter.KEYWORD);
return; // reference to trait method
}
}
@@ -1720,7 +1720,7 @@ public class GroovyAnnotator extends GroovyElementVisitor {
if (PsiTreeUtil.isAncestor(resolved, ref, true)) {
if (PsiUtil.hasEnclosingInstanceInScope((PsiClass)resolved, ref, true)) {
holder.createInfoAnnotation(nameElement, null).setTextAttributes(DefaultHighlighter.KEYWORD);
holder.createInfoAnnotation(nameElement, null).setTextAttributes(GroovySyntaxHighlighter.KEYWORD);
}
}
else {
@@ -1744,7 +1744,7 @@ public class GroovyAnnotator extends GroovyElementVisitor {
ASTNode node = element.getNode();
if (node != null && TokenSets.BUILT_IN_TYPES.contains(node.getElementType())) {
Annotation annotation = holder.createInfoAnnotation(element, null);
annotation.setTextAttributes(DefaultHighlighter.KEYWORD);
annotation.setTextAttributes(GroovySyntaxHighlighter.KEYWORD);
}
}
@@ -22,7 +22,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.highlighter.DefaultHighlighter;
import org.jetbrains.plugins.groovy.highlighter.GroovySyntaxHighlighter;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrBinaryExpression;
@@ -62,7 +62,7 @@ public class GrInspectionUtil {
HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(infotype).range(refNameElement);
builder.descriptionAndTooltip(message);
return builder.needsUpdateOnTyping(false).textAttributes(DefaultHighlighter.UNRESOLVED_ACCESS).create();
return builder.needsUpdateOnTyping(false).textAttributes(GroovySyntaxHighlighter.UNRESOLVED_ACCESS).create();
}
HighlightInfoType highlightInfoType = HighlightInfo.convertSeverity(displayLevel.getSeverity());
@@ -1,224 +0,0 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.groovy.highlighter;
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
import com.intellij.ide.highlighter.JavaHighlightingColors;
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
import com.intellij.openapi.editor.HighlighterColors;
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 com.intellij.ui.JBColor;
import com.intellij.util.ui.PlatformColors;
import org.jetbrains.annotations.NonNls;
import java.awt.*;
/**
* @author ilyas
*/
public class DefaultHighlighter {
@NonNls
static final String LINE_COMMENT_ID = "Line comment";
@NonNls
static final String BLOCK_COMMENT_ID = "Block comment";
@NonNls
static final String DOC_COMMENT_ID = "Groovydoc comment";
@NonNls
static final String DOC_COMMENT_TAG_ID = "Groovydoc tag";
@NonNls
static final String KEYWORD_ID = "Keyword";
@NonNls
static final String NUMBER_ID = "Number";
@NonNls
static final String GSTRING_ID = "GString";
@NonNls
static final String STRING_ID = "String";
@NonNls
static final String BRACES_ID = "Braces";
@NonNls
static final String BRACKETS_ID = "Brackets";
@NonNls
static final String PARENTHESES_ID = "Parentheses";
@NonNls
static final String OPERATION_SIGN_ID = "Operation sign";
@NonNls
static final String BAD_CHARACTER_ID = "Bad character";
@NonNls
static final String ANNOTATION_ID = "Annotation";
@NonNls
static final String INSTANCE_FIELD_ID = "Instance field";
@NonNls
static final String STATIC_FIELD_ID = "Static field";
@NonNls
static final String METHOD_CALL_ID = "Method call";
@NonNls
static final String STATIC_METHOD_ACCESS_ID = "Static method access";
@NonNls
static final String CLASS_REFERENCE_ID = "Class";
@NonNls
static final String TYPE_PARAMETER_ID = "Type parameter";
@NonNls
static final String INSTANCE_PROPERTY_REFERENCE_ID = "Instance property reference ID";
@NonNls
static final String STATIC_PROPERTY_REFERENCE_ID = "Static property reference ID";
@NonNls
static final String MAP_KEY_ID = "Map key";
@NonNls
static final String UNRESOLVED_ACCESS_ID = "Unresolved reference access";
@NonNls
static final String LITERAL_CONVERSION_ID = "List/map to object conversion";
@NonNls
static final String VALID_STRING_ESCAPE_ID = "Valid string escape";
@NonNls
static final String INVALID_STRING_ESCAPE_ID = "Invalid string escape";
@NonNls
static final String LABEL_ID = "Label";
public static final TextAttributesKey LINE_COMMENT =
TextAttributesKey.createTextAttributesKey(LINE_COMMENT_ID, DefaultLanguageHighlighterColors.LINE_COMMENT);
public static final TextAttributesKey ANNOTATION =
TextAttributesKey.createTextAttributesKey(ANNOTATION_ID, HighlightInfoType.ANNOTATION_NAME.getAttributesKey());
public static final TextAttributesKey LOCAL_VARIABLE =
TextAttributesKey.createTextAttributesKey("Groovy var", HighlightInfoType.LOCAL_VARIABLE.getAttributesKey());
public static final TextAttributesKey REASSIGNED_LOCAL_VARIABLE =
TextAttributesKey.createTextAttributesKey("Groovy reassigned var", HighlightInfoType.REASSIGNED_LOCAL_VARIABLE.getAttributesKey());
public static final TextAttributesKey PARAMETER =
TextAttributesKey.createTextAttributesKey("Groovy parameter", HighlightInfoType.PARAMETER.getAttributesKey());
public static final TextAttributesKey REASSIGNED_PARAMETER =
TextAttributesKey.createTextAttributesKey("Groovy reassigned parameter", HighlightInfoType.REASSIGNED_PARAMETER.getAttributesKey());
public static final TextAttributesKey METHOD_DECLARATION =
TextAttributesKey.createTextAttributesKey("Groovy method declaration", HighlightInfoType.METHOD_DECLARATION.getAttributesKey());
public static final TextAttributesKey CONSTRUCTOR_DECLARATION = TextAttributesKey
.createTextAttributesKey("Groovy constructor declaration", HighlightInfoType.CONSTRUCTOR_DECLARATION.getAttributesKey());
public static final TextAttributesKey INSTANCE_FIELD =
TextAttributesKey.createTextAttributesKey(INSTANCE_FIELD_ID, HighlightInfoType.INSTANCE_FIELD.getAttributesKey());
public static final TextAttributesKey METHOD_CALL =
TextAttributesKey.createTextAttributesKey(METHOD_CALL_ID, HighlightInfoType.METHOD_CALL.getAttributesKey());
public static final TextAttributesKey CONSTRUCTOR_CALL = TextAttributesKey
.createTextAttributesKey("Groovy constructor call", HighlightInfoType.CONSTRUCTOR_CALL.getAttributesKey());
public static final TextAttributesKey STATIC_FIELD =
TextAttributesKey.createTextAttributesKey(STATIC_FIELD_ID, HighlightInfoType.STATIC_FINAL_FIELD.getAttributesKey());
public static final TextAttributesKey STATIC_METHOD_ACCESS =
TextAttributesKey.createTextAttributesKey(STATIC_METHOD_ACCESS_ID, HighlightInfoType.STATIC_METHOD.getAttributesKey());
public static final TextAttributesKey BLOCK_COMMENT =
TextAttributesKey.createTextAttributesKey(BLOCK_COMMENT_ID, JavaHighlightingColors.JAVA_BLOCK_COMMENT);
public static final TextAttributesKey DOC_COMMENT_CONTENT =
TextAttributesKey.createTextAttributesKey(DOC_COMMENT_ID, JavaHighlightingColors.DOC_COMMENT);
public static final TextAttributesKey DOC_COMMENT_TAG =
TextAttributesKey.createTextAttributesKey(DOC_COMMENT_TAG_ID, JavaHighlightingColors.DOC_COMMENT_TAG);
public static final TextAttributesKey CLASS_REFERENCE =
TextAttributesKey.createTextAttributesKey(CLASS_REFERENCE_ID, HighlighterColors.TEXT);
public static final TextAttributesKey TYPE_PARAMETER =
TextAttributesKey.createTextAttributesKey(TYPE_PARAMETER_ID, CodeInsightColors.TYPE_PARAMETER_NAME_ATTRIBUTES);
public static final TextAttributes INSTANCE_PROPERTY_REFERENCE_ATTRIBUTES = INSTANCE_FIELD.getDefaultAttributes().clone();
public static final TextAttributes STATIC_PROPERTY_REFERENCE_ATTRIBUTES = STATIC_FIELD.getDefaultAttributes().clone();
static {
INSTANCE_PROPERTY_REFERENCE_ATTRIBUTES.setFontType(Font.PLAIN);
STATIC_PROPERTY_REFERENCE_ATTRIBUTES.setFontType(Font.ITALIC);
}
public static final TextAttributesKey INSTANCE_PROPERTY_REFERENCE =
TextAttributesKey.createTextAttributesKey(INSTANCE_PROPERTY_REFERENCE_ID, INSTANCE_PROPERTY_REFERENCE_ATTRIBUTES);
public static final TextAttributesKey STATIC_PROPERTY_REFERENCE =
TextAttributesKey.createTextAttributesKey(STATIC_PROPERTY_REFERENCE_ID, STATIC_PROPERTY_REFERENCE_ATTRIBUTES);
public static final TextAttributes KEYWORD_ATTRIBUTES = JavaHighlightingColors.KEYWORD.getDefaultAttributes().clone();
public static final TextAttributesKey KEYWORD = TextAttributesKey.createTextAttributesKey("GROOVY_" + KEYWORD_ID.toUpperCase(), KEYWORD_ATTRIBUTES);
static {
KEYWORD_ATTRIBUTES.setForegroundColor(new JBColor(new Color(0, 0, 67), new Color(0, 0, 67)));
KEYWORD_ATTRIBUTES.setFontType(Font.BOLD);
}
public static final TextAttributesKey NUMBER = TextAttributesKey.createTextAttributesKey(NUMBER_ID, JavaHighlightingColors.NUMBER);
public static final TextAttributesKey GSTRING = TextAttributesKey.createTextAttributesKey(GSTRING_ID, JavaHighlightingColors.STRING);
public static final TextAttributesKey STRING = TextAttributesKey.createTextAttributesKey(STRING_ID, JavaHighlightingColors.STRING);
public static final TextAttributesKey BRACES = TextAttributesKey.createTextAttributesKey(BRACES_ID, JavaHighlightingColors.BRACES);
public static final TextAttributesKey BRACKETS = TextAttributesKey.createTextAttributesKey(BRACKETS_ID, JavaHighlightingColors.BRACKETS);
public static final TextAttributesKey PARENTHESES = TextAttributesKey.createTextAttributesKey(PARENTHESES_ID, JavaHighlightingColors.PARENTHESES);
public static final TextAttributesKey OPERATION_SIGN = TextAttributesKey.createTextAttributesKey(OPERATION_SIGN_ID, JavaHighlightingColors.OPERATION_SIGN);
public static final TextAttributesKey BAD_CHARACTER = TextAttributesKey.createTextAttributesKey(BAD_CHARACTER_ID, CodeInsightColors.UNMATCHED_BRACE_ATTRIBUTES);
public static final TextAttributes UNRESOLVED_ACCESS_ATTRIBUTES = HighlighterColors.TEXT.getDefaultAttributes().clone();
static {
UNRESOLVED_ACCESS_ATTRIBUTES.setForegroundColor(JBColor.BLACK);
UNRESOLVED_ACCESS_ATTRIBUTES.setEffectColor(JBColor.GRAY);
UNRESOLVED_ACCESS_ATTRIBUTES.setEffectType(EffectType.LINE_UNDERSCORE);
}
public static final TextAttributesKey UNRESOLVED_ACCESS =
TextAttributesKey.createTextAttributesKey(UNRESOLVED_ACCESS_ID, UNRESOLVED_ACCESS_ATTRIBUTES);
public static final TextAttributes LITERAL_CONVERSION_ATTRIBUTES = HighlighterColors.TEXT.getDefaultAttributes().clone();
static{
LITERAL_CONVERSION_ATTRIBUTES.setForegroundColor(PlatformColors.BLUE);
LITERAL_CONVERSION_ATTRIBUTES.setFontType(Font.BOLD);
}
public static final TextAttributesKey LITERAL_CONVERSION =
TextAttributesKey.createTextAttributesKey(LITERAL_CONVERSION_ID, LITERAL_CONVERSION_ATTRIBUTES);
public static final TextAttributes MAP_KEY_ATTRIBUTES = HighlighterColors.TEXT.getDefaultAttributes().clone();
public static final Color MAP_KEY_COLOR = new JBColor(new Color(0, 128, 0), new Color(0, 128, 0));
static {
MAP_KEY_ATTRIBUTES.setForegroundColor(MAP_KEY_COLOR);
}
public static final TextAttributesKey MAP_KEY = TextAttributesKey.createTextAttributesKey(MAP_KEY_ID, MAP_KEY_ATTRIBUTES);
public static final TextAttributesKey VALID_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey(VALID_STRING_ESCAPE_ID, JavaHighlightingColors.VALID_STRING_ESCAPE);
public static final TextAttributesKey INVALID_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey(INVALID_STRING_ESCAPE_ID, JavaHighlightingColors.INVALID_STRING_ESCAPE);
public static final TextAttributesKey LABEL = TextAttributesKey.createTextAttributesKey(LABEL_ID, HighlighterColors.TEXT);
private DefaultHighlighter() {
}
}
@@ -37,7 +37,7 @@ public class GroovyEditorHighlighter extends LayeredLexerEditorHighlighter {
private void registerGroovydocHighlighter() {
// Register GroovyDoc Highlighter
SyntaxHighlighter groovyDocHighlighter = new GroovyDocSyntaxHighlighter();
final LayerDescriptor groovyDocLayer = new LayerDescriptor(groovyDocHighlighter, "\n", DefaultHighlighter.DOC_COMMENT_CONTENT);
final LayerDescriptor groovyDocLayer = new LayerDescriptor(groovyDocHighlighter, "\n", GroovySyntaxHighlighter.DOC_COMMENT_CONTENT);
registerLayer(GroovyDocElementTypes.GROOVY_DOC_COMMENT, groovyDocLayer);
}
@@ -17,9 +17,12 @@
package org.jetbrains.plugins.groovy.highlighter;
import com.intellij.ide.PowerSaveMode;
import com.intellij.ide.highlighter.JavaHighlightingColors;
import com.intellij.lexer.LayeredLexer;
import com.intellij.lexer.Lexer;
import com.intellij.lexer.StringLiteralLexer;
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
import com.intellij.openapi.editor.HighlighterColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
import com.intellij.psi.StringEscapesTokenTypes;
@@ -34,11 +37,54 @@ import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
import java.util.HashMap;
import java.util.Map;
import static com.intellij.openapi.editor.colors.CodeInsightColors.*;
import static com.intellij.openapi.editor.colors.TextAttributesKey.createTextAttributesKey;
/**
* @author ilyas
*/
public class GroovySyntaxHighlighter extends SyntaxHighlighterBase {
public static final TextAttributesKey LINE_COMMENT = createTextAttributesKey("Line comment", DefaultLanguageHighlighterColors.LINE_COMMENT);
public static final TextAttributesKey ANNOTATION = createTextAttributesKey("Annotation", ANNOTATION_NAME_ATTRIBUTES);
public static final TextAttributesKey LOCAL_VARIABLE = createTextAttributesKey("Groovy var", LOCAL_VARIABLE_ATTRIBUTES);
public static final TextAttributesKey REASSIGNED_LOCAL_VARIABLE = createTextAttributesKey("Groovy reassigned var", REASSIGNED_LOCAL_VARIABLE_ATTRIBUTES);
public static final TextAttributesKey PARAMETER = createTextAttributesKey("Groovy parameter", PARAMETER_ATTRIBUTES);
public static final TextAttributesKey REASSIGNED_PARAMETER = createTextAttributesKey("Groovy reassigned parameter", REASSIGNED_PARAMETER_ATTRIBUTES);
public static final TextAttributesKey METHOD_DECLARATION = createTextAttributesKey("Groovy method declaration", METHOD_DECLARATION_ATTRIBUTES);
public static final TextAttributesKey CONSTRUCTOR_DECLARATION = createTextAttributesKey("Groovy constructor declaration", CONSTRUCTOR_DECLARATION_ATTRIBUTES);
public static final TextAttributesKey INSTANCE_FIELD = createTextAttributesKey("Instance field", INSTANCE_FIELD_ATTRIBUTES);
public static final TextAttributesKey METHOD_CALL = createTextAttributesKey("Method call", METHOD_CALL_ATTRIBUTES);
public static final TextAttributesKey CONSTRUCTOR_CALL = createTextAttributesKey("Groovy constructor call", CONSTRUCTOR_CALL_ATTRIBUTES);
public static final TextAttributesKey STATIC_FIELD = createTextAttributesKey("Static field", STATIC_FINAL_FIELD_ATTRIBUTES);
public static final TextAttributesKey STATIC_METHOD_ACCESS = createTextAttributesKey("Static method access", STATIC_METHOD_ATTRIBUTES);
public static final TextAttributesKey BLOCK_COMMENT = createTextAttributesKey("Block comment", JavaHighlightingColors.JAVA_BLOCK_COMMENT);
public static final TextAttributesKey DOC_COMMENT_CONTENT = createTextAttributesKey("Groovydoc comment", JavaHighlightingColors.DOC_COMMENT);
public static final TextAttributesKey DOC_COMMENT_TAG = createTextAttributesKey("Groovydoc tag", JavaHighlightingColors.DOC_COMMENT_TAG);
public static final TextAttributesKey CLASS_REFERENCE = createTextAttributesKey("Class", DefaultLanguageHighlighterColors.CLASS_REFERENCE);
public static final TextAttributesKey TYPE_PARAMETER = createTextAttributesKey("Type parameter", TYPE_PARAMETER_NAME_ATTRIBUTES);
public static final TextAttributesKey INSTANCE_PROPERTY_REFERENCE = createTextAttributesKey("Instance property reference ID", INSTANCE_FIELD_ATTRIBUTES);
public static final TextAttributesKey STATIC_PROPERTY_REFERENCE = createTextAttributesKey("Static property reference ID", STATIC_FINAL_FIELD_ATTRIBUTES);
public static final TextAttributesKey KEYWORD = createTextAttributesKey("GROOVY_KEYWORD", JavaHighlightingColors.KEYWORD);
public static final TextAttributesKey NUMBER = createTextAttributesKey("Number", JavaHighlightingColors.NUMBER);
public static final TextAttributesKey GSTRING = createTextAttributesKey("GString", JavaHighlightingColors.STRING);
public static final TextAttributesKey STRING = createTextAttributesKey("String", JavaHighlightingColors.STRING);
public static final TextAttributesKey BRACES = createTextAttributesKey("Braces", JavaHighlightingColors.BRACES);
public static final TextAttributesKey BRACKETS = createTextAttributesKey("Brackets", JavaHighlightingColors.BRACKETS);
public static final TextAttributesKey PARENTHESES = createTextAttributesKey("Parentheses", JavaHighlightingColors.PARENTHESES);
public static final TextAttributesKey OPERATION_SIGN = createTextAttributesKey("Operation sign", JavaHighlightingColors.OPERATION_SIGN);
public static final TextAttributesKey BAD_CHARACTER = createTextAttributesKey("Bad character", HighlighterColors.BAD_CHARACTER);
public static final TextAttributesKey UNRESOLVED_ACCESS = createTextAttributesKey("Unresolved reference access", DefaultLanguageHighlighterColors.IDENTIFIER);
public static final TextAttributesKey LITERAL_CONVERSION = createTextAttributesKey("List/map to object conversion", JavaHighlightingColors.NUMBER);
public static final TextAttributesKey MAP_KEY = createTextAttributesKey("Map key", JavaHighlightingColors.STRING);
public static final TextAttributesKey VALID_STRING_ESCAPE = createTextAttributesKey("Valid string escape", JavaHighlightingColors.VALID_STRING_ESCAPE);
public static final TextAttributesKey INVALID_STRING_ESCAPE = createTextAttributesKey("Invalid string escape", JavaHighlightingColors.INVALID_STRING_ESCAPE);
public static final TextAttributesKey LABEL = createTextAttributesKey("Label", DefaultLanguageHighlighterColors.LABEL);
private static final Map<IElementType, TextAttributesKey> ATTRIBUTES = new HashMap<IElementType, TextAttributesKey>();
private static final Map<IElementType, TextAttributesKey> POWER_SAVE_MODE_ATTRIBUTES = new HashMap<IElementType, TextAttributesKey>();
@@ -83,41 +129,41 @@ public class GroovySyntaxHighlighter extends SyntaxHighlighterBase {
static final TokenSet tOperators = TokenSet.orSet(TokenSets.BINARY_OP_SET, TokenSets.UNARY_OP_SET, TokenSets.ASSIGN_OP_SET);
static {
fillMap(ATTRIBUTES, tLINE_COMMENTS, DefaultHighlighter.LINE_COMMENT);
fillMap(ATTRIBUTES, tBLOCK_COMMENTS, DefaultHighlighter.BLOCK_COMMENT);
fillMap(ATTRIBUTES, tBAD_CHARACTERS, DefaultHighlighter.BAD_CHARACTER);
fillMap(ATTRIBUTES, TokenSets.NUMBERS, DefaultHighlighter.NUMBER);
fillMap(ATTRIBUTES, tGSTRINGS, DefaultHighlighter.GSTRING);
fillMap(ATTRIBUTES, tSTRINGS, DefaultHighlighter.STRING);
fillMap(ATTRIBUTES, DefaultHighlighter.STRING, GroovyTokenTypes.mREGEX_BEGIN, GroovyTokenTypes.mREGEX_CONTENT,
fillMap(ATTRIBUTES, tLINE_COMMENTS, LINE_COMMENT);
fillMap(ATTRIBUTES, tBLOCK_COMMENTS, BLOCK_COMMENT);
fillMap(ATTRIBUTES, tBAD_CHARACTERS, BAD_CHARACTER);
fillMap(ATTRIBUTES, TokenSets.NUMBERS, NUMBER);
fillMap(ATTRIBUTES, tGSTRINGS, GSTRING);
fillMap(ATTRIBUTES, tSTRINGS, STRING);
fillMap(ATTRIBUTES, STRING, GroovyTokenTypes.mREGEX_BEGIN, GroovyTokenTypes.mREGEX_CONTENT,
GroovyTokenTypes.mREGEX_END, GroovyTokenTypes.mDOLLAR_SLASH_REGEX_BEGIN, GroovyTokenTypes.mDOLLAR_SLASH_REGEX_CONTENT,
GroovyTokenTypes.mDOLLAR_SLASH_REGEX_END);
fillMap(ATTRIBUTES, tBRACES, DefaultHighlighter.BRACES);
fillMap(ATTRIBUTES, tBRACKETS, DefaultHighlighter.BRACKETS);
fillMap(ATTRIBUTES, tPARENTHESES, DefaultHighlighter.PARENTHESES);
fillMap(ATTRIBUTES, tOperators, DefaultHighlighter.OPERATION_SIGN);
fillMap(ATTRIBUTES, DefaultHighlighter.VALID_STRING_ESCAPE, StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN);
fillMap(ATTRIBUTES, DefaultHighlighter.INVALID_STRING_ESCAPE, StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN);
fillMap(ATTRIBUTES, DefaultHighlighter.INVALID_STRING_ESCAPE, StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN);
fillMap(ATTRIBUTES, tBRACES, BRACES);
fillMap(ATTRIBUTES, tBRACKETS, BRACKETS);
fillMap(ATTRIBUTES, tPARENTHESES, PARENTHESES);
fillMap(ATTRIBUTES, tOperators, OPERATION_SIGN);
fillMap(ATTRIBUTES, VALID_STRING_ESCAPE, StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN);
fillMap(ATTRIBUTES, INVALID_STRING_ESCAPE, StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN);
fillMap(ATTRIBUTES, INVALID_STRING_ESCAPE, StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN);
}
static {
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tLINE_COMMENTS, DefaultHighlighter.LINE_COMMENT);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tBLOCK_COMMENTS, DefaultHighlighter.BLOCK_COMMENT);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tBAD_CHARACTERS, DefaultHighlighter.BAD_CHARACTER);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, TokenSets.NUMBERS, DefaultHighlighter.NUMBER);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tGSTRINGS, DefaultHighlighter.GSTRING);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tSTRINGS, DefaultHighlighter.STRING);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, DefaultHighlighter.STRING, GroovyTokenTypes.mREGEX_BEGIN, GroovyTokenTypes.mREGEX_CONTENT,
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tLINE_COMMENTS, LINE_COMMENT);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tBLOCK_COMMENTS, BLOCK_COMMENT);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tBAD_CHARACTERS, BAD_CHARACTER);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, TokenSets.NUMBERS, NUMBER);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tGSTRINGS, GSTRING);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tSTRINGS, STRING);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, STRING, GroovyTokenTypes.mREGEX_BEGIN, GroovyTokenTypes.mREGEX_CONTENT,
GroovyTokenTypes.mREGEX_END, GroovyTokenTypes.mDOLLAR_SLASH_REGEX_BEGIN,
GroovyTokenTypes.mDOLLAR_SLASH_REGEX_CONTENT, GroovyTokenTypes.mDOLLAR_SLASH_REGEX_END);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tBRACES, DefaultHighlighter.BRACES);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tBRACKETS, DefaultHighlighter.BRACKETS);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tPARENTHESES, DefaultHighlighter.PARENTHESES);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, DefaultHighlighter.VALID_STRING_ESCAPE, StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, DefaultHighlighter.INVALID_STRING_ESCAPE, StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, DefaultHighlighter.INVALID_STRING_ESCAPE, StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, TokenSets.KEYWORDS, DefaultHighlighter.KEYWORD);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tBRACES, BRACES);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tBRACKETS, BRACKETS);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, tPARENTHESES, PARENTHESES);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, VALID_STRING_ESCAPE, StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, INVALID_STRING_ESCAPE, StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, INVALID_STRING_ESCAPE, StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN);
fillMap(POWER_SAVE_MODE_ATTRIBUTES, TokenSets.KEYWORDS, KEYWORD);
}
@Override
@@ -22,7 +22,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.highlighter.DefaultHighlighter;
import org.jetbrains.plugins.groovy.highlighter.GroovySyntaxHighlighter;
import org.jetbrains.plugins.groovy.lang.groovydoc.lexer.GroovyDocElementTypeImpl;
import org.jetbrains.plugins.groovy.lang.groovydoc.lexer.GroovyDocLexer;
import org.jetbrains.plugins.groovy.lang.groovydoc.lexer.GroovyDocTokenTypes;
@@ -53,8 +53,8 @@ public class GroovyDocSyntaxHighlighter extends SyntaxHighlighterBase {
static {
fillMap(ATTRIBUTES, tGDOC_COMMENT_CONTENT, DefaultHighlighter.DOC_COMMENT_CONTENT);
fillMap(ATTRIBUTES, tGDOC_COMMENT_TAGS, DefaultHighlighter.DOC_COMMENT_TAG);
fillMap(ATTRIBUTES, tGDOC_COMMENT_CONTENT, GroovySyntaxHighlighter.DOC_COMMENT_CONTENT);
fillMap(ATTRIBUTES, tGDOC_COMMENT_TAGS, GroovySyntaxHighlighter.DOC_COMMENT_TAG);
}
+3
View File
@@ -223,6 +223,9 @@
</extensions>
<extensions defaultExtensionNs="com.intellij">
<additionalTextAttributes scheme="Default" file="colorSchemes/GroovyDefault.xml"/>
<additionalTextAttributes scheme="Darcula" file="colorSchemes/GroovyDarcula.xml"/>
<navbar implementation="org.jetbrains.plugins.groovy.navbar.GrNavBarModelExtension"/>
<fileTypeDetector implementation="org.jetbrains.plugins.groovy.GroovyHashBangFileTypeDetector"/>
@@ -53,42 +53,42 @@ public class GroovyColorsAndFontsPage implements ColorSettingsPage {
private static final AttributesDescriptor[] ATTRS =
new AttributesDescriptor[]{
new AttributesDescriptor("Line comment", DefaultHighlighter.LINE_COMMENT),
new AttributesDescriptor("Block comment", DefaultHighlighter.BLOCK_COMMENT),
new AttributesDescriptor("Groovydoc comment", DefaultHighlighter.DOC_COMMENT_CONTENT),
new AttributesDescriptor("Groovydoc tag", DefaultHighlighter.DOC_COMMENT_TAG),
new AttributesDescriptor("Keyword", DefaultHighlighter.KEYWORD),
new AttributesDescriptor("Number", DefaultHighlighter.NUMBER),
new AttributesDescriptor("GString", DefaultHighlighter.GSTRING),
new AttributesDescriptor("String", DefaultHighlighter.STRING),
new AttributesDescriptor("Braces", DefaultHighlighter.BRACES),
new AttributesDescriptor("Brackets", DefaultHighlighter.BRACKETS),
new AttributesDescriptor("Parentheses", DefaultHighlighter.PARENTHESES),
new AttributesDescriptor("Operation sign", DefaultHighlighter.OPERATION_SIGN),
new AttributesDescriptor("Bad character", DefaultHighlighter.BAD_CHARACTER),
//new AttributesDescriptor("Wrong string literal", DefaultHighlighter.WRONG_STRING),
new AttributesDescriptor("Unresolved reference access", DefaultHighlighter.UNRESOLVED_ACCESS),
new AttributesDescriptor("List/map to object conversion", DefaultHighlighter.LITERAL_CONVERSION),
new AttributesDescriptor("Annotation", DefaultHighlighter.ANNOTATION),
new AttributesDescriptor("Local variable", DefaultHighlighter.LOCAL_VARIABLE),
new AttributesDescriptor("Reassigned local variable", DefaultHighlighter.REASSIGNED_LOCAL_VARIABLE),
new AttributesDescriptor("Parameter", DefaultHighlighter.PARAMETER),
new AttributesDescriptor("Reassigned parameter", DefaultHighlighter.REASSIGNED_PARAMETER),
new AttributesDescriptor("Static field", DefaultHighlighter.STATIC_FIELD),
new AttributesDescriptor("Instance field", DefaultHighlighter.INSTANCE_FIELD),
new AttributesDescriptor("Constructor call", DefaultHighlighter.CONSTRUCTOR_CALL),
new AttributesDescriptor("Instance method call", DefaultHighlighter.METHOD_CALL),
new AttributesDescriptor("Static method call", DefaultHighlighter.STATIC_METHOD_ACCESS),
new AttributesDescriptor("Method declaration", DefaultHighlighter.METHOD_DECLARATION),
new AttributesDescriptor("Constructor declaration", DefaultHighlighter.CONSTRUCTOR_DECLARATION),
new AttributesDescriptor("Class reference", DefaultHighlighter.CLASS_REFERENCE),
new AttributesDescriptor("Type parameter reference", DefaultHighlighter.TYPE_PARAMETER),
new AttributesDescriptor("Map key accessed as a property", DefaultHighlighter.MAP_KEY),
new AttributesDescriptor("Instance property reference", DefaultHighlighter.INSTANCE_PROPERTY_REFERENCE),
new AttributesDescriptor("Static property reference", DefaultHighlighter.STATIC_PROPERTY_REFERENCE),
new AttributesDescriptor("Valid string escape", DefaultHighlighter.VALID_STRING_ESCAPE),
new AttributesDescriptor("Invalid string escape", DefaultHighlighter.INVALID_STRING_ESCAPE),
new AttributesDescriptor("Label", DefaultHighlighter.LABEL),
new AttributesDescriptor("Line comment", GroovySyntaxHighlighter.LINE_COMMENT),
new AttributesDescriptor("Block comment", GroovySyntaxHighlighter.BLOCK_COMMENT),
new AttributesDescriptor("Groovydoc comment", GroovySyntaxHighlighter.DOC_COMMENT_CONTENT),
new AttributesDescriptor("Groovydoc tag", GroovySyntaxHighlighter.DOC_COMMENT_TAG),
new AttributesDescriptor("Keyword", GroovySyntaxHighlighter.KEYWORD),
new AttributesDescriptor("Number", GroovySyntaxHighlighter.NUMBER),
new AttributesDescriptor("GString", GroovySyntaxHighlighter.GSTRING),
new AttributesDescriptor("String", GroovySyntaxHighlighter.STRING),
new AttributesDescriptor("Braces", GroovySyntaxHighlighter.BRACES),
new AttributesDescriptor("Brackets", GroovySyntaxHighlighter.BRACKETS),
new AttributesDescriptor("Parentheses", GroovySyntaxHighlighter.PARENTHESES),
new AttributesDescriptor("Operation sign", GroovySyntaxHighlighter.OPERATION_SIGN),
new AttributesDescriptor("Bad character", GroovySyntaxHighlighter.BAD_CHARACTER),
//new AttributesDescriptor("Wrong string literal", GroovySyntaxHighlighter.WRONG_STRING),
new AttributesDescriptor("Unresolved reference access", GroovySyntaxHighlighter.UNRESOLVED_ACCESS),
new AttributesDescriptor("List/map to object conversion", GroovySyntaxHighlighter.LITERAL_CONVERSION),
new AttributesDescriptor("Annotation", GroovySyntaxHighlighter.ANNOTATION),
new AttributesDescriptor("Local variable", GroovySyntaxHighlighter.LOCAL_VARIABLE),
new AttributesDescriptor("Reassigned local variable", GroovySyntaxHighlighter.REASSIGNED_LOCAL_VARIABLE),
new AttributesDescriptor("Parameter", GroovySyntaxHighlighter.PARAMETER),
new AttributesDescriptor("Reassigned parameter", GroovySyntaxHighlighter.REASSIGNED_PARAMETER),
new AttributesDescriptor("Static field", GroovySyntaxHighlighter.STATIC_FIELD),
new AttributesDescriptor("Instance field", GroovySyntaxHighlighter.INSTANCE_FIELD),
new AttributesDescriptor("Constructor call", GroovySyntaxHighlighter.CONSTRUCTOR_CALL),
new AttributesDescriptor("Instance method call", GroovySyntaxHighlighter.METHOD_CALL),
new AttributesDescriptor("Static method call", GroovySyntaxHighlighter.STATIC_METHOD_ACCESS),
new AttributesDescriptor("Method declaration", GroovySyntaxHighlighter.METHOD_DECLARATION),
new AttributesDescriptor("Constructor declaration", GroovySyntaxHighlighter.CONSTRUCTOR_DECLARATION),
new AttributesDescriptor("Class reference", GroovySyntaxHighlighter.CLASS_REFERENCE),
new AttributesDescriptor("Type parameter reference", GroovySyntaxHighlighter.TYPE_PARAMETER),
new AttributesDescriptor("Map key accessed as a property", GroovySyntaxHighlighter.MAP_KEY),
new AttributesDescriptor("Instance property reference", GroovySyntaxHighlighter.INSTANCE_PROPERTY_REFERENCE),
new AttributesDescriptor("Static property reference", GroovySyntaxHighlighter.STATIC_PROPERTY_REFERENCE),
new AttributesDescriptor("Valid string escape", GroovySyntaxHighlighter.VALID_STRING_ESCAPE),
new AttributesDescriptor("Invalid string escape", GroovySyntaxHighlighter.INVALID_STRING_ESCAPE),
new AttributesDescriptor("Label", GroovySyntaxHighlighter.LABEL),
};
@Override
@@ -148,31 +148,31 @@ public class GroovyColorsAndFontsPage implements ColorSettingsPage {
@Nullable
public Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() {
Map<String, TextAttributesKey> map = new HashMap<String, TextAttributesKey>();
map.put("keyword", DefaultHighlighter.KEYWORD);
map.put("annotation", DefaultHighlighter.ANNOTATION);
map.put("statmet", DefaultHighlighter.STATIC_METHOD_ACCESS);
map.put("instmet", DefaultHighlighter.METHOD_CALL);
map.put("constructorCall", DefaultHighlighter.CONSTRUCTOR_CALL);
map.put("statfield", DefaultHighlighter.STATIC_FIELD);
map.put("instfield", DefaultHighlighter.INSTANCE_FIELD);
map.put("gdoc", DefaultHighlighter.DOC_COMMENT_CONTENT);
map.put("doctag", DefaultHighlighter.DOC_COMMENT_TAG);
map.put("unresolved", DefaultHighlighter.UNRESOLVED_ACCESS);
map.put("classref", DefaultHighlighter.CLASS_REFERENCE);
map.put("typeparam", DefaultHighlighter.TYPE_PARAMETER);
map.put("literal", DefaultHighlighter.LITERAL_CONVERSION);
map.put("mapkey", DefaultHighlighter.MAP_KEY);
map.put("prop", DefaultHighlighter.INSTANCE_PROPERTY_REFERENCE);
map.put("staticprop", DefaultHighlighter.STATIC_PROPERTY_REFERENCE);
map.put("validescape", DefaultHighlighter.VALID_STRING_ESCAPE);
map.put("invalidescape", DefaultHighlighter.INVALID_STRING_ESCAPE);
map.put("local", DefaultHighlighter.LOCAL_VARIABLE);
map.put("reLocal", DefaultHighlighter.REASSIGNED_LOCAL_VARIABLE);
map.put("param", DefaultHighlighter.PARAMETER);
map.put("reParam", DefaultHighlighter.REASSIGNED_PARAMETER);
map.put("method", DefaultHighlighter.METHOD_DECLARATION);
map.put("constructor", DefaultHighlighter.CONSTRUCTOR_DECLARATION);
map.put("label", DefaultHighlighter.LABEL);
map.put("keyword", GroovySyntaxHighlighter.KEYWORD);
map.put("annotation", GroovySyntaxHighlighter.ANNOTATION);
map.put("statmet", GroovySyntaxHighlighter.STATIC_METHOD_ACCESS);
map.put("instmet", GroovySyntaxHighlighter.METHOD_CALL);
map.put("constructorCall", GroovySyntaxHighlighter.CONSTRUCTOR_CALL);
map.put("statfield", GroovySyntaxHighlighter.STATIC_FIELD);
map.put("instfield", GroovySyntaxHighlighter.INSTANCE_FIELD);
map.put("gdoc", GroovySyntaxHighlighter.DOC_COMMENT_CONTENT);
map.put("doctag", GroovySyntaxHighlighter.DOC_COMMENT_TAG);
map.put("unresolved", GroovySyntaxHighlighter.UNRESOLVED_ACCESS);
map.put("classref", GroovySyntaxHighlighter.CLASS_REFERENCE);
map.put("typeparam", GroovySyntaxHighlighter.TYPE_PARAMETER);
map.put("literal", GroovySyntaxHighlighter.LITERAL_CONVERSION);
map.put("mapkey", GroovySyntaxHighlighter.MAP_KEY);
map.put("prop", GroovySyntaxHighlighter.INSTANCE_PROPERTY_REFERENCE);
map.put("staticprop", GroovySyntaxHighlighter.STATIC_PROPERTY_REFERENCE);
map.put("validescape", GroovySyntaxHighlighter.VALID_STRING_ESCAPE);
map.put("invalidescape", GroovySyntaxHighlighter.INVALID_STRING_ESCAPE);
map.put("local", GroovySyntaxHighlighter.LOCAL_VARIABLE);
map.put("reLocal", GroovySyntaxHighlighter.REASSIGNED_LOCAL_VARIABLE);
map.put("param", GroovySyntaxHighlighter.PARAMETER);
map.put("reParam", GroovySyntaxHighlighter.REASSIGNED_PARAMETER);
map.put("method", GroovySyntaxHighlighter.METHOD_DECLARATION);
map.put("constructor", GroovySyntaxHighlighter.CONSTRUCTOR_DECLARATION);
map.put("label", GroovySyntaxHighlighter.LABEL);
return map;
}
}
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.extensions.GroovyNamedArgumentProvider;
import org.jetbrains.plugins.groovy.extensions.NamedArgumentDescriptor;
import org.jetbrains.plugins.groovy.highlighter.DefaultHighlighter;
import org.jetbrains.plugins.groovy.highlighter.GroovySyntaxHighlighter;
import org.jetbrains.plugins.groovy.lang.completion.handlers.NamedArgumentInsertHandler;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap;
@@ -37,8 +37,8 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgument
import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArgument;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrCall;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyNamesUtil;
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
import java.util.Collections;
import java.util.HashMap;
@@ -97,7 +97,7 @@ class MapArgumentCompletionProvider extends CompletionProvider<CompletionParamet
.withTailText(":");
if (entry.getValue().getPriority() == NamedArgumentDescriptor.Priority.UNLIKELY) {
lookup.withItemTextForeground(DefaultHighlighter.MAP_KEY_COLOR);
lookup.withItemTextForeground(GroovySyntaxHighlighter.MAP_KEY.getDefaultAttributes().getForegroundColor());
}
else {
lookup = lookup.withIcon(JetgroovyIcons.Groovy.DynamicProperty);