on master help sign in
dhall: additional highlight queries (#5959)
87518dbJared Beller
runtime/queries/dhall/highlights.scm+83−25
@@ -1,52 +1,110 @@
1;; Literals
1;; Literals
2−
3(integer_literal) @constant.numeric.integer
2(integer_literal) @constant.numeric.integer
4(natural_literal) @constant.numeric.integer
3(natural_literal) @constant.numeric.integer
5(double_literal) @constant.numeric.float
4(double_literal) @constant.numeric.float
6(boolean_literal) @constant.builtin.boolean
5(boolean_literal) @constant.builtin.boolean
6+(builtin "None") @constant.builtin
7+
8+;; Text
7(text_literal) @string
9(text_literal) @string
10+(interpolation "}" @string)
11+(double_quote_escaped) @constant.character.escape
12+(single_quote_escaped) @constant.character.escape
13+
14+;; Imports
8(local_import) @string.special.path
15(local_import) @string.special.path
9(http_import) @string.special.url
16(http_import) @string.special.url
17+(env_import) @keyword
18+(env_variable) @string.special
10−(import_hash) @string
19+(import_hash) @string.special
20+(missing_import) @keyword.control.import
21+[ (import_as_location) (import_as_text) ] @type
11
22
12;; Comments
23;; Comments
13−[
24+(block_comment) @comment.block
14− (line_comment)
25+(line_comment) @comment.line
15− (block_comment)
26+
16−] @comment
27+;; Types
28+([
29+ (let_binding (label) @type)
30+ (union_type_entry (label) @type)
31+] (#match? @type "^[A-Z]"))
32+((primitive_expression
33+ (identifier (label) @type)
34+ (selector (label) @type)?) @whole_identifier
35+ (#match? @whole_identifier "(?:^|\\.)[A-Z][^.]*$"))
36+
37+;; Variables
38+(identifier [
39+ (label) @variable
40+ (de_bruijn_index) @operator
41+])
42+(let_binding label: (label) @variable)
43+(lambda_expression label: (label) @variable.parameter)
44+(record_literal_entry (label) @variable.other.member)
45+(record_type_entry (label) @variable.other.member)
46+(selector) @variable.other.member
17
47
18;; Keywords
48;; Keywords
19[
49[
20− ("let")
50+ "let"
21− ("in")
51+ "in"
22− (assign_operator)
52+ "assert"
53+] @keyword
54+[
55+ "using"
56+ "as"
57+ "with"
58+] @keyword.operator
59+
60+;; Operators
61+[
23 (type_operator)
62 (type_operator)
63+ (assign_operator)
24 (lambda_operator)
64 (lambda_operator)
25 (arrow_operator)
65 (arrow_operator)
26 (infix_operator)
66 (infix_operator)
27 (completion_operator)
67 (completion_operator)
28− ("using")
29− ("assert")
30 (assert_operator)
68 (assert_operator)
31− ("as")
32 (forall_operator)
69 (forall_operator)
33− ("with")
70+ (empty_record_literal)
34−] @keyword
71+] @operator
35
72
36;; Builtins
73;; Builtins
37−[
38− (builtin_function)
74+(builtin_function) @function.builtin
39− (missing_import)
75+(builtin [
40−] @function.builtin
76+ "Bool"
77+ "Optional"
78+ "Natural"
79+ "Integer"
80+ "Double"
81+ "Text"
82+ "Date"
83+ "Time"
84+ "TimeZone"
85+ "List"
86+ "Type"
87+ "Kind"
88+ "Sort"
89+] @type.builtin)
41
90
42−[
91+;; Punctuation
43− (builtin)
92+[ "," "|" ] @punctuation.delimiter
44− (import_as_text)
93+(selector_dot) @punctuation.delimiter
45−] @type.builtin
94+[
95+ "("
96+ ")"
97+ "{"
98+ "}"
99+ "["
100+ "]"
101+ "<"
102+ ">"
103+] @punctuation.bracket
46
104
47;; Conditionals
105;; Conditionals
48[
106[
49− ("if")
107+ "if"
50− ("then")
108+ "then"
51− ("else")
109+ "else"
52] @keyword.control.conditional
110] @keyword.control.conditional
runtime/queries/dhall/injections.scmnew file+2
@@ -0,0 +1,2 @@
1+([(block_comment) (line_comment)] @injection.content
2+ (#set! injection.language "comment"))