Fixed highlighting of builtin annotations (they were highlighted like keywords).
This commit is contained in:
@@ -22,8 +22,10 @@ package org.jetbrains.jet.plugin.highlighter;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.annotation.AnnotationHolder;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.impl.source.tree.LeafPsiElement;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
|
||||
@@ -35,8 +37,13 @@ class SoftKeywordsHighlightingVisitor extends HighlightingVisitor {
|
||||
@Override
|
||||
public void visitElement(PsiElement element) {
|
||||
if (element instanceof LeafPsiElement) {
|
||||
if (JetTokens.SOFT_KEYWORDS.contains(((LeafPsiElement) element).getElementType())) {
|
||||
holder.createInfoAnnotation(element, null).setTextAttributes(JetHighlightingColors.KEYWORD);
|
||||
IElementType elementType = ((LeafPsiElement)element).getElementType();
|
||||
if (JetTokens.SOFT_KEYWORDS.contains(elementType)) {
|
||||
TextAttributesKey attributes = JetHighlightingColors.KEYWORD;
|
||||
if (JetTokens.MODIFIER_KEYWORDS.contains(elementType)) {
|
||||
attributes = JetHighlightingColors.BUILTIN_ANNOTATION;
|
||||
}
|
||||
holder.createInfoAnnotation(element, null).setTextAttributes(attributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ fun <info textAttributesKey="KOTLIN_FUNCTION_DECLARATION">global</info>() {
|
||||
fun Int.<info textAttributesKey="KOTLIN_FUNCTION_DECLARATION">ext</info>() {
|
||||
}
|
||||
|
||||
<info textAttributesKey="KOTLIN_KEYWORD">open</info> class <info textAttributesKey="KOTLIN_CLASS">Container</info> {
|
||||
<info textAttributesKey="KOTLIN_KEYWORD">open</info> fun <info textAttributesKey="KOTLIN_FUNCTION_DECLARATION">member</info>() {
|
||||
<info textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">open</info> class <info textAttributesKey="KOTLIN_CLASS">Container</info> {
|
||||
<info textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">open</info> fun <info textAttributesKey="KOTLIN_FUNCTION_DECLARATION">member</info>() {
|
||||
<info textAttributesKey="KOTLIN_NAMESPACE_FUNCTION_CALL">global</info>()
|
||||
5.<info textAttributesKey="KOTLIN_EXTENSION_FUNCTION_CALL">ext</info>()
|
||||
<info textAttributesKey="KOTLIN_FUNCTION_CALL">member</info>()
|
||||
|
||||
@@ -4,9 +4,9 @@ trait <info textAttributesKey="KOTLIN_TRAIT">TheTrait</info> {
|
||||
class <info textAttributesKey="KOTLIN_CLASS">TheClass</info> : <info textAttributesKey="KOTLIN_TRAIT">TheTrait</info> {
|
||||
}
|
||||
|
||||
<info textAttributesKey="KOTLIN_KEYWORD">annotation</info> class <info textAttributesKey="KOTLIN_ANNOTATION">magnificent</info>
|
||||
<info textAttributesKey="KOTLIN_KEYWORD">annotation</info> class <info textAttributesKey="KOTLIN_ANNOTATION">deprecated</info>
|
||||
<info textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">annotation</info> class <info textAttributesKey="KOTLIN_ANNOTATION">magnificent</info>
|
||||
<info textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">annotation</info> class <info textAttributesKey="KOTLIN_ANNOTATION">deprecated</info>
|
||||
|
||||
[<info textAttributesKey="KOTLIN_ANNOTATION">deprecated</info>]
|
||||
<info textAttributesKey="KOTLIN_ANNOTATION">magnificent</info> <info textAttributesKey="KOTLIN_KEYWORD">abstract</info> class <info textAttributesKey="KOTLIN_ABSTRACT_CLASS">AbstractClass</info><<info textAttributesKey="KOTLIN_TYPE_PARAMETER">T</info>> {
|
||||
<info textAttributesKey="KOTLIN_ANNOTATION">magnificent</info> <info textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">abstract</info> class <info textAttributesKey="KOTLIN_ABSTRACT_CLASS">AbstractClass</info><<info textAttributesKey="KOTLIN_TYPE_PARAMETER">T</info>> {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user