Skip to content

Commit 57ba500

Browse files
committed
chore: format queries with ts_query_ls
1 parent f35527e commit 57ba500

File tree

4 files changed

+101
-102
lines changed

4 files changed

+101
-102
lines changed

queries/highlights.scm

Lines changed: 87 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,122 @@
1-
;; Keywords
2-
1+
; Keywords
32
"return" @keyword.return
43

54
[
6-
"goto"
7-
"in"
8-
"local"
5+
"goto"
6+
"in"
7+
"local"
98
] @keyword
109

1110
(label_statement) @label
1211

1312
(break_statement) @keyword
1413

1514
(do_statement
16-
[
17-
"do"
18-
"end"
19-
] @keyword)
15+
[
16+
"do"
17+
"end"
18+
] @keyword)
2019

2120
(while_statement
22-
[
23-
"while"
24-
"do"
25-
"end"
26-
] @repeat)
21+
[
22+
"while"
23+
"do"
24+
"end"
25+
] @repeat)
2726

2827
(repeat_statement
29-
[
30-
"repeat"
31-
"until"
32-
] @repeat)
28+
[
29+
"repeat"
30+
"until"
31+
] @repeat)
3332

3433
(if_statement
35-
[
36-
"if"
37-
"elseif"
38-
"else"
39-
"then"
40-
"end"
41-
] @conditional)
34+
[
35+
"if"
36+
"elseif"
37+
"else"
38+
"then"
39+
"end"
40+
] @conditional)
4241

4342
(elseif_statement
44-
[
45-
"elseif"
46-
"then"
47-
"end"
48-
] @conditional)
43+
[
44+
"elseif"
45+
"then"
46+
"end"
47+
] @conditional)
4948

5049
(else_statement
51-
[
52-
"else"
53-
"end"
54-
] @conditional)
50+
[
51+
"else"
52+
"end"
53+
] @conditional)
5554

5655
(for_statement
57-
[
58-
"for"
59-
"do"
60-
"end"
61-
] @repeat)
56+
[
57+
"for"
58+
"do"
59+
"end"
60+
] @repeat)
6261

6362
(function_declaration
64-
[
65-
"function"
66-
"end"
67-
] @keyword.function)
63+
[
64+
"function"
65+
"end"
66+
] @keyword.function)
6867

6968
(function_definition
70-
[
71-
"function"
72-
"end"
73-
] @keyword.function)
74-
75-
;; Operators
69+
[
70+
"function"
71+
"end"
72+
] @keyword.function)
7673

77-
(binary_expression operator: _ @operator)
74+
; Operators
75+
(binary_expression
76+
operator: _ @operator)
7877

79-
(unary_expression operator: _ @operator)
78+
(unary_expression
79+
operator: _ @operator)
8080

8181
[
82-
"and"
83-
"not"
84-
"or"
82+
"and"
83+
"not"
84+
"or"
8585
] @keyword.operator
8686

87-
;; Punctuations
88-
87+
; Punctuations
8988
[
9089
";"
9190
":"
9291
","
9392
"."
9493
] @punctuation.delimiter
9594

96-
;; Brackets
97-
95+
; Brackets
9896
[
99-
"("
100-
")"
101-
"["
102-
"]"
103-
"{"
104-
"}"
97+
"("
98+
")"
99+
"["
100+
"]"
101+
"{"
102+
"}"
105103
] @punctuation.bracket
106104

107-
;; Variables
108-
105+
; Variables
109106
(identifier) @variable
110107

111108
((identifier) @variable.builtin
112-
(#eq? @variable.builtin "self"))
109+
(#eq? @variable.builtin "self"))
113110

114111
(variable_list
115112
(attribute
116113
"<" @punctuation.bracket
117114
(identifier) @attribute
118115
">" @punctuation.bracket))
119116

120-
;; Constants
121-
117+
; Constants
122118
((identifier) @constant
123-
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
119+
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
124120

125121
(vararg_expression) @constant
126122

@@ -131,21 +127,22 @@
131127
(true)
132128
] @boolean
133129

134-
;; Tables
135-
136-
(field name: (identifier) @field)
130+
; Tables
131+
(field
132+
name: (identifier) @field)
137133

138-
(dot_index_expression field: (identifier) @field)
134+
(dot_index_expression
135+
field: (identifier) @field)
139136

140137
(table_constructor
141-
[
142-
"{"
143-
"}"
144-
] @constructor)
138+
[
139+
"{"
140+
"}"
141+
] @constructor)
145142

146-
;; Functions
147-
148-
(parameters (identifier) @parameter)
143+
; Functions
144+
(parameters
145+
(identifier) @parameter)
149146

150147
(function_declaration
151148
name: [
@@ -159,13 +156,15 @@
159156
method: (identifier) @method))
160157

161158
(assignment_statement
162-
(variable_list .
159+
(variable_list
160+
.
163161
name: [
164162
(identifier) @function
165163
(dot_index_expression
166164
field: (identifier) @function)
167165
])
168-
(expression_list .
166+
(expression_list
167+
.
169168
value: (function_definition)))
170169

171170
(table_constructor
@@ -185,14 +184,12 @@
185184
(function_call
186185
(identifier) @function.builtin
187186
(#any-of? @function.builtin
188-
;; built-in functions in Lua 5.1
189-
"assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs"
190-
"load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print"
191-
"rawequal" "rawget" "rawset" "require" "select" "setfenv" "setmetatable"
192-
"tonumber" "tostring" "type" "unpack" "xpcall"))
193-
194-
;; Others
187+
; built-in functions in Lua 5.1
188+
"assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs" "load" "loadfile"
189+
"loadstring" "module" "next" "pairs" "pcall" "print" "rawequal" "rawget" "rawset" "require"
190+
"select" "setfenv" "setmetatable" "tonumber" "tostring" "type" "unpack" "xpcall"))
195191

192+
; Others
196193
(comment) @comment
197194

198195
(hash_bang_line) @preproc

queries/injections.scm

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
((function_call
22
name: [
33
(identifier) @_cdef_identifier
4-
(_ _ (identifier) @_cdef_identifier)
4+
(_
5+
_
6+
(identifier) @_cdef_identifier)
57
]
6-
arguments: (arguments (string content: _ @injection.content
7-
(#set! injection.language "c"))))
8+
arguments: (arguments
9+
(string
10+
content: _ @injection.content
11+
(#set! injection.language "c"))))
812
(#eq? @_cdef_identifier "cdef"))

queries/locals.scm

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
; Scopes
2-
32
[
43
(chunk)
54
(do_statement)
@@ -12,7 +11,6 @@
1211
] @local.scope
1312

1413
; Definitions
15-
1614
(assignment_statement
1715
(variable_list
1816
(identifier) @local.definition))
@@ -27,10 +25,8 @@
2725
(for_numeric_clause
2826
name: (identifier) @local.definition)
2927

30-
(parameters (identifier) @local.definition)
28+
(parameters
29+
(identifier) @local.definition)
3130

3231
; References
33-
34-
[
35-
(identifier)
36-
] @local.reference
32+
(identifier) @local.reference

queries/tags.scm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
method: (identifier) @name)) @definition.method
1111

1212
(assignment_statement
13-
(variable_list .
13+
(variable_list
14+
.
1415
name: [
1516
(identifier) @name
1617
(dot_index_expression
1718
field: (identifier) @name)
1819
])
19-
(expression_list .
20+
(expression_list
21+
.
2022
value: (function_definition))) @definition.function
2123

2224
(table_constructor

0 commit comments

Comments
 (0)