Skip to content

Commit a307897

Browse files
committed
Update highlighter
1 parent 470b44f commit a307897

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/com/intellij/devkt/json/Json.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package com.intellij.devkt.json;
22

3-
import org.ice1000.devkt.openapi.AnnotationHolder;
43
import org.ice1000.devkt.openapi.ColorScheme;
54
import org.ice1000.devkt.openapi.ExtendedDevKtLanguage;
65
import org.jetbrains.annotations.NotNull;
76
import org.jetbrains.annotations.Nullable;
8-
import org.jetbrains.kotlin.com.intellij.psi.PsiElement;
9-
import org.jetbrains.kotlin.com.intellij.psi.PsiErrorElement;
7+
import org.jetbrains.kotlin.com.intellij.psi.StringEscapesTokenTypes;
108
import org.jetbrains.kotlin.com.intellij.psi.tree.IElementType;
119

1210
import javax.swing.*;
@@ -33,11 +31,6 @@ public boolean satisfies(String fileName) {
3331
return fileName.endsWith(".json") || fileName.equals(".pinpoint");
3432
}
3533

36-
@Override
37-
public void annotate(PsiElement psiElement, AnnotationHolder<? super T> annotationHolder, ColorScheme<? extends T> colorScheme) {
38-
if (psiElement instanceof PsiErrorElement) annotationHolder.highlight(psiElement, colorScheme.getUnknown());
39-
}
40-
4134
@Override
4235
public @Nullable
4336
T attributesOf(IElementType iElementType, ColorScheme<? extends T> colorScheme) {
@@ -46,10 +39,13 @@ T attributesOf(IElementType iElementType, ColorScheme<? extends T> colorScheme)
4639
else if (iElementType == JsonElementTypes.NUMBER) return colorScheme.getNumbers();
4740
else if (iElementType == JsonElementTypes.SINGLE_QUOTED_STRING) return colorScheme.getString();
4841
else if (iElementType == JsonElementTypes.DOUBLE_QUOTED_STRING) return colorScheme.getProperty();
42+
else if (iElementType == StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN) return colorScheme.getStringEscape();
4943
else if (iElementType == JsonElementTypes.IDENTIFIER) return colorScheme.getIdentifiers();
44+
else if (iElementType == JsonElementTypes.COLON) return colorScheme.getColon();
45+
else if (iElementType == JsonElementTypes.COMMA) return colorScheme.getComma();
5046
else if (JsonParserDefinition.JSON_BRACES.contains(iElementType)) return colorScheme.getBraces();
5147
else if (JsonParserDefinition.JSON_KEYWORDS.contains(iElementType)) return colorScheme.getKeywords();
5248
else if (JsonParserDefinition.JSON_BRACKETS.contains(iElementType)) return colorScheme.getBrackets();
53-
else return null;
49+
else return super.attributesOf(iElementType, colorScheme);
5450
}
5551
}

0 commit comments

Comments
 (0)