on master help sign in
dhall: additional highlight queries (#5959)
commit87518db1d12ea48a4d2fce7808e24852992b03ee authorJared Beller <25756846+jbellerb@users.noreply.github.com> dateSun 12 Feb 2023, 21:04 (4 years ago) parentc71b4c5
2 files changed+85−25
runtime/queries/dhall/highlights.scm+83−25 runtime/queries/dhall/injections.scm+2
runtime/queries/dhall/highlights.scm+83−25
@@ -1,52 +1,110 @@
11;; Literals
2−
32(integer_literal) @constant.numeric.integer
43(natural_literal) @constant.numeric.integer
54(double_literal) @constant.numeric.float
65(boolean_literal) @constant.builtin.boolean
6+(builtin "None") @constant.builtin
7+
8+;; Text
79(text_literal) @string
10+(interpolation "}" @string)
11+(double_quote_escaped) @constant.character.escape
12+(single_quote_escaped) @constant.character.escape
13+
14+;; Imports
815(local_import) @string.special.path
916(http_import) @string.special.url
10−(import_hash) @string
17+(env_import) @keyword
18+(env_variable) @string.special
19+(import_hash) @string.special
20+(missing_import) @keyword.control.import
21+[ (import_as_location) (import_as_text) ] @type
1122
1223;; Comments
13−[
14− (line_comment)
15− (block_comment)
16−] @comment
24+(block_comment) @comment.block
25+(line_comment) @comment.line
26+
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
1747
1848;; Keywords
1949[
20− ("let")
21− ("in")
22− (assign_operator)
50+ "let"
51+ "in"
52+ "assert"
53+] @keyword
54+[
55+ "using"
56+ "as"
57+ "with"
58+] @keyword.operator
59+
60+;; Operators
61+[
2362 (type_operator)
63+ (assign_operator)
2464 (lambda_operator)
2565 (arrow_operator)
2666 (infix_operator)
2767 (completion_operator)
28− ("using")
29− ("assert")
3068 (assert_operator)
31− ("as")
3269 (forall_operator)
33− ("with")
34−] @keyword
70+ (empty_record_literal)
71+] @operator
3572
3673;; Builtins
37−[
38− (builtin_function)
39− (missing_import)
40−] @function.builtin
74+(builtin_function) @function.builtin
75+(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)
4190
42−[
43− (builtin)
44− (import_as_text)
45−] @type.builtin
91+;; Punctuation
92+[ "," "|" ] @punctuation.delimiter
93+(selector_dot) @punctuation.delimiter
94+[
95+ "("
96+ ")"
97+ "{"
98+ "}"
99+ "["
100+ "]"
101+ "<"
102+ ">"
103+] @punctuation.bracket
46104
47105;; Conditionals
48106[
49− ("if")
50− ("then")
51− ("else")
107+ "if"
108+ "then"
109+ "else"
52110] @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"))