Skip to content

Commit ec6047f

Browse files
authored
Merge pull request #48 from Wilfred/highlights
Add syntax highlighting queries
2 parents 0a3dd53 + 046776b commit ec6047f

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

queries/highlights.scm

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
;; Annotations
2+
3+
"@" @operator
4+
5+
;; Types
6+
7+
(class_definition
8+
name: (identifier) @type)
9+
(trait_definition
10+
name: (identifier) @type)
11+
(object_definition
12+
name: (identifier) @type)
13+
14+
(type_identifier) @type
15+
16+
;; Variables
17+
18+
((identifier) @constant
19+
(#match? @constant "^_*[A-Z][A-Z\\d_]+$"))
20+
21+
(identifier) @variable
22+
23+
;; Literals
24+
25+
[
26+
(integer_literal)
27+
(floating_point_literal)
28+
] @number
29+
30+
[
31+
(character_literal)
32+
(string)
33+
] @string
34+
35+
[
36+
(boolean_literal)
37+
(null_literal)
38+
] @constant.builtin
39+
40+
(comment) @comment
41+
42+
;; Keywords
43+
44+
[
45+
"abstract"
46+
"case"
47+
"catch"
48+
"class"
49+
"def"
50+
"do"
51+
"else"
52+
"extends"
53+
"final"
54+
"finally"
55+
"for"
56+
"if"
57+
"implicit"
58+
"import"
59+
"lazy"
60+
"match"
61+
"new"
62+
"object"
63+
"override"
64+
"package"
65+
"private"
66+
"protected"
67+
"return"
68+
"sealed"
69+
"throw"
70+
"trait"
71+
"try"
72+
"while"
73+
"with"
74+
] @keyword

0 commit comments

Comments
 (0)