on 6c11708 help sign in
helix/runtime/queries/lua/highlights.scm
166 lines 2.3 kB history raw
1;;; Highlighting for lua
3;;; Builtins
4(self) @variable.builtin
6;; Keywords
8(if_statement
9[
10 "if"
11 "then"
12 "end"
13] @keyword.control.conditional)
16 "else"
17 "elseif"
18 "then"
19] @keyword.control.conditional
21(for_statement
23 "for"
24 "do"
25 "end"
26] @keyword.control.repeat)
28(for_in_statement
30 "for"
31 "do"
32 "end"
33] @keyword.control.repeat)
35(while_statement
37 "while"
38 "do"
39 "end"
40] @keyword.control.repeat)
42(repeat_statement
44 "repeat"
45 "until"
46] @keyword.control.repeat)
48(do_statement
50 "do"
51 "end"
52] @keyword)
55 "in"
56 "local"
57 (break_statement)
58 "goto"
59 "return"
60] @keyword
62;; Operators
65 "not"
66 "and"
67 "or"
68] @operator
71"="
72"~="
73"=="
74"<="
75">="
76"<"
77">"
78"+"
79"-"
80"%"
81"/"
82"//"
83"*"
84"^"
85"&"
86"~"
87"|"
88">>"
89"<<"
90".."
91"#"
92 ] @operator
94;; Punctuation
95["," "." ":" ";"] @punctuation.delimiter
97;; Brackets
99 "("
100 ")"
101 "["
102 "]"
103 "{"
104 "}"
105] @punctuation.bracket
107; ;; Constants
109(false)
110(true)
111] @constant.builtin.boolean
112(nil) @constant.builtin
113(spread) @constant ;; "..."
114((identifier) @constant
115 (#match? @constant "^[A-Z][A-Z_0-9]*$"))
117;; Parameters
118(parameters
119 (identifier) @variable.parameter)
121; ;; Functions
122(function [(function_name) (identifier)] @function)
123(function ["function" "end"] @keyword.function)
125(function
126 (function_name
127 (function_name_field
128 (property_identifier) @function .)))
130(local_function (identifier) @function)
131(local_function ["function" "end"] @keyword.function)
133(variable_declaration
134 (variable_declarator (identifier) @function) (function_definition))
135(local_variable_declaration
136 (variable_declarator (identifier) @function) (function_definition))
138(function_definition ["function" "end"] @keyword.function)
140(function_call
141 [
142 ((identifier) @variable (method) @function.method)
143 ((_) (method) @function.method)
144 (identifier) @function
145 (field_expression (property_identifier) @function)
146 ]
147 . (arguments))
149;; Nodes
150(table ["{" "}"] @constructor)
151(comment) @comment
152(string) @string
153(number) @constant.numeric.integer
154(label_statement) @label
155; A bit of a tricky one, this will only match field names
156(field . (identifier) @variable.other.member (_))
157(shebang) @comment
159;; Property
160(property_identifier) @variable.other.member
162;; Variable
163(identifier) @variable
165;; Error
166(ERROR) @error