Skip to content

Commit 5df231f

Browse files
committed
Fixed missing syntax highlighting colors due to uninitialized JavaScript colors being referenced from GraphQL (#158)
1 parent 5b37708 commit 5df231f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/com/intellij/lang/jsgraphql/ide/highlighting/JSGraphQLSyntaxHighlighter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88
package com.intellij.lang.jsgraphql.ide.highlighting;
99

10+
import com.intellij.lang.javascript.highlighting.JSHighlighter;
1011
import com.intellij.lang.jsgraphql.JSGraphQLTokenTypes;
1112
import com.intellij.lang.jsgraphql.lexer.JSGraphQLLexer;
1213
import com.intellij.lexer.Lexer;
@@ -20,7 +21,9 @@
2021

2122
public class JSGraphQLSyntaxHighlighter extends SyntaxHighlighterBase {
2223

23-
public static final TextAttributesKey KEYWORD = createTextAttributesKey("JSGRAPHQL.KEYWORD", TextAttributesKey.find("JS.KEYWORD"));
24+
// reference the JS highlighter here to ensure it has initialized the colors and the find by id calls below work predictably instead of relying on class loader order
25+
public static final TextAttributesKey KEYWORD = createTextAttributesKey("JSGRAPHQL.KEYWORD", JSHighlighter.JS_KEYWORD);
26+
2427
public static final TextAttributesKey PUNCTUATION = createTextAttributesKey("JSGRAPHQL.PUNCTUATION", TextAttributesKey.find("JS.COMMA"));
2528
public static final TextAttributesKey PAREN = createTextAttributesKey("JSGRAPHQL.PAREN", TextAttributesKey.find("JS.PARENTHS"));
2629
public static final TextAttributesKey BRACE = createTextAttributesKey("JSGRAPHQL.BRACE", TextAttributesKey.find("JS.BRACES"));

0 commit comments

Comments
 (0)