@@ -2,7 +2,9 @@ package org.intellij.clojure.devkt
2
2
3
3
import org.ice1000.devkt.openapi.*
4
4
import org.intellij.clojure.devkt.lang.*
5
+ import org.intellij.clojure.devkt.psi.*
5
6
import org.intellij.clojure.devkt.psi.ClojureTypes.*
7
+ import org.intellij.clojure.devkt.util.*
6
8
import org.jetbrains.kotlin.com.intellij.psi.PsiElement
7
9
import org.jetbrains.kotlin.com.intellij.psi.tree.IElementType
8
10
@@ -16,6 +18,11 @@ class Clojure<TextAttributes> : ExtendedDevKtLanguage<TextAttributes>(
16
18
fileName.endsWith(" .cljs" ) ||
17
19
fileName.endsWith(" .cljc" )
18
20
21
+ /* *
22
+ * @param type IElementType
23
+ * @param colorScheme ColorScheme<TextAttributes>
24
+ * @return TextAttributes?
25
+ */
19
26
override fun attributesOf (type : IElementType , colorScheme : ColorScheme <TextAttributes >) = when (type) {
20
27
ClojureTokens .LINE_COMMENT -> colorScheme.lineComments
21
28
C_STRING -> colorScheme.string
@@ -33,16 +40,38 @@ class Clojure<TextAttributes> : ExtendedDevKtLanguage<TextAttributes>(
33
40
C_QUOTE -> colorScheme.string
34
41
C_TILDE , C_TILDE_AT -> colorScheme.operators
35
42
C_AT -> colorScheme.operators
36
- // C_HAT, C_SHARP_HAT -> colorScheme.metadata
37
- // C_SHARP, C_SHARP_COMMENT, C_SHARP_EQ, C_SHARP_NS -> pack(ClojureColors.READER_MACRO)
38
- // C_SHARP_QMARK, C_SHARP_QMARK_AT, C_SHARP_QUOTE -> pack(ClojureColors.READER_MACRO)
43
+ // C_HAT, C_SHARP_HAT -> colorScheme.metadata
44
+ // C_SHARP, C_SHARP_COMMENT, C_SHARP_EQ, C_SHARP_NS -> pack(ClojureColors.READER_MACRO)
45
+ // C_SHARP_QMARK, C_SHARP_QMARK_AT, C_SHARP_QUOTE -> pack(ClojureColors.READER_MACRO)
39
46
C_PAREN1 , C_PAREN2 -> colorScheme.parentheses
40
47
C_BRACE1 , C_BRACE2 -> colorScheme.braces
41
48
C_BRACKET1 , C_BRACKET2 -> colorScheme.brackets
42
49
else -> null
43
50
}
44
51
45
- override fun annotate (element : PsiElement , document : AnnotationHolder <TextAttributes >, colorScheme : ColorScheme <TextAttributes >) {
46
- // TODO
52
+ /* *
53
+ * @param element PsiElement
54
+ * @param document AnnotationHolder<TextAttributes>
55
+ * @param colorScheme ColorScheme<TextAttributes>
56
+ */
57
+ override fun annotate (
58
+ element : PsiElement ,
59
+ document : AnnotationHolder <TextAttributes >,
60
+ colorScheme : ColorScheme <TextAttributes >) {
61
+ val callable = element is CSForm && element.parentForm.let {
62
+ it is CList && it.firstForm == element && it.iterate(CReaderMacro ::class ).isEmpty
63
+ }
64
+ if (callable) document.highlight(element.valueRange, colorScheme.keywords)
65
+ when (element) {
66
+ is CMetadata -> {
67
+ element.firstForm.let {
68
+ // / if (it is CSymbol) document.highlight(it, null)
69
+ // TODO metadata
70
+ }
71
+ }
72
+ }
73
+ if (element is CForm && element.iterate(CReaderMacro ::class )
74
+ .find { it.firstChild.elementType == ClojureTypes .C_SHARP_COMMENT } != null )
75
+ document.highlight(element, colorScheme.docComments)
47
76
}
48
77
}
0 commit comments