1
1
package com .intellij .devkt .json ;
2
2
3
- import org .ice1000 .devkt .openapi .AnnotationHolder ;
4
3
import org .ice1000 .devkt .openapi .ColorScheme ;
5
4
import org .ice1000 .devkt .openapi .ExtendedDevKtLanguage ;
6
5
import org .jetbrains .annotations .NotNull ;
7
6
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 ;
10
8
import org .jetbrains .kotlin .com .intellij .psi .tree .IElementType ;
11
9
12
10
import javax .swing .*;
@@ -33,11 +31,6 @@ public boolean satisfies(String fileName) {
33
31
return fileName .endsWith (".json" ) || fileName .equals (".pinpoint" );
34
32
}
35
33
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
-
41
34
@ Override
42
35
public @ Nullable
43
36
T attributesOf (IElementType iElementType , ColorScheme <? extends T > colorScheme ) {
@@ -46,10 +39,13 @@ T attributesOf(IElementType iElementType, ColorScheme<? extends T> colorScheme)
46
39
else if (iElementType == JsonElementTypes .NUMBER ) return colorScheme .getNumbers ();
47
40
else if (iElementType == JsonElementTypes .SINGLE_QUOTED_STRING ) return colorScheme .getString ();
48
41
else if (iElementType == JsonElementTypes .DOUBLE_QUOTED_STRING ) return colorScheme .getProperty ();
42
+ else if (iElementType == StringEscapesTokenTypes .VALID_STRING_ESCAPE_TOKEN ) return colorScheme .getStringEscape ();
49
43
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 ();
50
46
else if (JsonParserDefinition .JSON_BRACES .contains (iElementType )) return colorScheme .getBraces ();
51
47
else if (JsonParserDefinition .JSON_KEYWORDS .contains (iElementType )) return colorScheme .getKeywords ();
52
48
else if (JsonParserDefinition .JSON_BRACKETS .contains (iElementType )) return colorScheme .getBrackets ();
53
- else return null ;
49
+ else return super . attributesOf ( iElementType , colorScheme ) ;
54
50
}
55
51
}
0 commit comments