@@ -5,6 +5,8 @@ import org.intellij.clojure.devkt.lang.*
5
5
import org.intellij.clojure.devkt.psi.*
6
6
import org.intellij.clojure.devkt.psi.ClojureTypes.*
7
7
import org.intellij.clojure.devkt.util.*
8
+ import org.jetbrains.kotlin.com.intellij.lexer.Lexer
9
+ import org.jetbrains.kotlin.com.intellij.openapi.project.Project
8
10
import org.jetbrains.kotlin.com.intellij.psi.PsiElement
9
11
import org.jetbrains.kotlin.com.intellij.psi.PsiErrorElement
10
12
import org.jetbrains.kotlin.com.intellij.psi.tree.IElementType
@@ -19,6 +21,10 @@ class Clojure<TextAttributes> : ExtendedDevKtLanguage<TextAttributes>(
19
21
fileName.endsWith(" .cljs" ) ||
20
22
fileName.endsWith(" .cljc" )
21
23
24
+ override fun createLexer (project : Project ): Lexer {
25
+ return ClojureHighlightingLexer (ClojureLanguage )
26
+ }
27
+
22
28
/* *
23
29
* @param type IElementType
24
30
* @param colorScheme ColorScheme<TextAttributes>
@@ -41,16 +47,16 @@ class Clojure<TextAttributes> : ExtendedDevKtLanguage<TextAttributes>(
41
47
C_QUOTE -> colorScheme.string
42
48
C_TILDE , C_TILDE_AT -> colorScheme.operators
43
49
C_AT -> colorScheme.operators
44
- // C_HAT, C_SHARP_HAT -> colorScheme.metadata
45
- // C_SHARP, C_SHARP_COMMENT, C_SHARP_EQ, C_SHARP_NS -> pack(ClojureColors.READER_MACRO)
46
- // C_SHARP_QMARK, C_SHARP_QMARK_AT, C_SHARP_QUOTE -> pack(ClojureColors.READER_MACRO)
50
+ C_HAT , C_SHARP_HAT -> colorScheme.metaData
51
+ C_SHARP , C_SHARP_COMMENT , C_SHARP_EQ , C_SHARP_NS -> colorScheme.macro
52
+ C_SHARP_QMARK , C_SHARP_QMARK_AT , C_SHARP_QUOTE -> colorScheme.macro
47
53
C_PAREN1 , C_PAREN2 -> colorScheme.parentheses
48
54
C_BRACE1 , C_BRACE2 -> colorScheme.braces
49
55
C_BRACKET1 , C_BRACKET2 -> colorScheme.brackets
50
- // ClojureHighlightingLexer.CALLABLE -> pack(ClojureColors.CALLABLE)
51
- C_KEYWORD -> colorScheme.keywords
52
- // ClojureHighlightingLexer.CALLABLE_KEYWORD -> pack(ClojureColors.CALLABLE, ClojureColors.KEYWORD)
53
- // ClojureHighlightingLexer.QUOTED_SYM -> pack(ClojureColors.QUOTED_SYM)
56
+ ClojureHighlightingLexer .CALLABLE -> colorScheme.keywords
57
+ ClojureHighlightingLexer . KEYWORD -> colorScheme.keywords
58
+ ClojureHighlightingLexer .CALLABLE_KEYWORD -> colorScheme.keywords
59
+ ClojureHighlightingLexer .QUOTED_SYM -> colorScheme.string
54
60
else -> null
55
61
}
56
62
@@ -69,11 +75,8 @@ class Clojure<TextAttributes> : ExtendedDevKtLanguage<TextAttributes>(
69
75
if (callable) document.highlight(element.valueRange, colorScheme.keywords)
70
76
when (element) {
71
77
is PsiErrorElement -> document.highlight(element, colorScheme.unknown)
72
- is CMetadata -> {
73
- element.firstForm.let {
74
- // / if (it is CSymbol) document.highlight(it, null)
75
- // TODO metadata
76
- }
78
+ is CMetadata -> element.firstForm.let {
79
+ if (it is CSymbol ) document.highlight(it, colorScheme.metaData)
77
80
}
78
81
}
79
82
if (element is CForm && element.iterate(CReaderMacro ::class )
0 commit comments