ts-wasms 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/README.md +26 -9
  2. package/index.d.ts +102 -0
  3. package/index.js +27 -0
  4. package/out/angular/folds.scm +1 -0
  5. package/out/angular/highlights.scm +178 -0
  6. package/out/angular/indents.scm +16 -0
  7. package/out/angular/injections.scm +1 -0
  8. package/out/angular/locals.scm +1 -0
  9. package/out/angular/tree-sitter-angular.wasm +0 -0
  10. package/out/asm/highlights.scm +66 -0
  11. package/out/asm/injections.scm +5 -0
  12. package/out/asm/tree-sitter-asm.wasm +0 -0
  13. package/out/astro/folds.scm +1 -0
  14. package/out/astro/highlights.scm +12 -0
  15. package/out/astro/indents.scm +1 -0
  16. package/out/astro/injections.scm +27 -0
  17. package/out/astro/locals.scm +1 -0
  18. package/out/astro/tree-sitter-astro.wasm +0 -0
  19. package/out/bash/folds.scm +9 -0
  20. package/out/bash/indents.scm +32 -0
  21. package/out/bash/injections.scm +90 -0
  22. package/out/bash/locals.scm +14 -0
  23. package/out/c/folds.scm +23 -0
  24. package/out/c/indents.scm +99 -0
  25. package/out/c/injections.scm +128 -0
  26. package/out/c/locals.scm +67 -0
  27. package/out/clojure/folds.scm +2 -0
  28. package/out/clojure/injections.scm +2 -0
  29. package/out/clojure/locals.scm +1 -0
  30. package/out/cmake/folds.scm +8 -0
  31. package/out/cmake/highlights.scm +221 -0
  32. package/out/cmake/indents.scm +26 -0
  33. package/out/cmake/injections.scm +5 -0
  34. package/out/cmake/tree-sitter-cmake.wasm +0 -0
  35. package/out/comment/highlights.scm +49 -0
  36. package/out/comment/tree-sitter-comment.wasm +0 -0
  37. package/out/commonlisp/folds.scm +2 -0
  38. package/out/commonlisp/injections.scm +5 -0
  39. package/out/commonlisp/locals.scm +109 -0
  40. package/out/cpp/folds.scm +14 -0
  41. package/out/cpp/indents.scm +8 -0
  42. package/out/cpp/locals.scm +78 -0
  43. package/out/css/folds.scm +10 -0
  44. package/out/css/indents.scm +11 -0
  45. package/out/css/injections.scm +2 -0
  46. package/out/csv/highlights.scm +5 -0
  47. package/out/csv/tree-sitter-csv.wasm +0 -0
  48. package/out/csv-psv/highlights.scm +5 -0
  49. package/out/csv-psv/tree-sitter-csv-psv.wasm +0 -0
  50. package/out/csv-tsv/highlights.scm +4 -0
  51. package/out/csv-tsv/tree-sitter-csv-tsv.wasm +0 -0
  52. package/out/dart/indents.scm +49 -0
  53. package/out/dart/injections.scm +2 -0
  54. package/out/dart/locals.scm +32 -0
  55. package/out/diff/folds.scm +5 -0
  56. package/out/diff/highlights.scm +49 -0
  57. package/out/diff/injections.scm +2 -0
  58. package/out/diff/tree-sitter-diff.wasm +0 -0
  59. package/out/dockerfile/highlights.scm +58 -0
  60. package/out/dockerfile/injections.scm +12 -0
  61. package/out/dockerfile/tree-sitter-dockerfile.wasm +0 -0
  62. package/out/dtd/folds.scm +4 -0
  63. package/out/dtd/injections.scm +2 -0
  64. package/out/dtd/locals.scm +11 -0
  65. package/out/editorconfig/folds.scm +1 -0
  66. package/out/editorconfig/highlights.scm +35 -0
  67. package/out/editorconfig/injections.scm +2 -0
  68. package/out/editorconfig/tree-sitter-editorconfig.wasm +0 -0
  69. package/out/elixir/folds.scm +10 -0
  70. package/out/elixir/indents.scm +25 -0
  71. package/out/elixir/locals.scm +200 -0
  72. package/out/elm/folds.scm +14 -0
  73. package/out/erlang/folds.scm +9 -0
  74. package/out/erlang/injections.scm +2 -0
  75. package/out/fish/folds.scm +8 -0
  76. package/out/fish/highlights.scm +61 -0
  77. package/out/fish/indents.scm +18 -0
  78. package/out/fish/injections.scm +2 -0
  79. package/out/fish/locals.scm +19 -0
  80. package/out/fish/tree-sitter-fish.wasm +0 -0
  81. package/out/gdscript/folds.scm +26 -0
  82. package/out/gdscript/highlights.scm +635 -0
  83. package/out/gdscript/indents.scm +78 -0
  84. package/out/gdscript/injections.scm +2 -0
  85. package/out/gdscript/locals.scm +121 -0
  86. package/out/gdscript/tree-sitter-gdscript.wasm +0 -0
  87. package/out/gdshader/highlights.scm +256 -0
  88. package/out/gdshader/injections.scm +2 -0
  89. package/out/gdshader/locals.scm +24 -0
  90. package/out/gdshader/tags.scm +13 -0
  91. package/out/gdshader/tree-sitter-gdshader.wasm +0 -0
  92. package/out/git-config/highlights.scm +28 -0
  93. package/out/git-config/tree-sitter-git-config.wasm +0 -0
  94. package/out/git-rebase/highlights.scm +36 -0
  95. package/out/git-rebase/tree-sitter-git-rebase.wasm +0 -0
  96. package/out/gitattributes/highlights.scm +52 -0
  97. package/out/gitattributes/injections.scm +2 -0
  98. package/out/gitattributes/locals.scm +8 -0
  99. package/out/gitattributes/tree-sitter-gitattributes.wasm +0 -0
  100. package/out/gitignore/highlights.scm +36 -0
  101. package/out/gitignore/injections.scm +2 -0
  102. package/out/gitignore/tree-sitter-gitignore.wasm +0 -0
  103. package/out/go/folds.scm +19 -0
  104. package/out/go/indents.scm +48 -0
  105. package/out/go/injections.scm +42 -0
  106. package/out/go/locals.scm +88 -0
  107. package/out/godot-resource/tree-sitter-godot-resource.wasm +0 -0
  108. package/out/graphql/indents.scm +11 -0
  109. package/out/graphql/injections.scm +2 -0
  110. package/out/groovy/folds.scm +6 -0
  111. package/out/groovy/highlights.scm +148 -0
  112. package/out/groovy/indents.scm +23 -0
  113. package/out/groovy/injections.scm +5 -0
  114. package/out/groovy/locals.scm +6 -0
  115. package/out/groovy/tree-sitter-groovy.wasm +0 -0
  116. package/out/haskell/folds.scm +6 -0
  117. package/out/hcl/folds.scm +6 -0
  118. package/out/hcl/indents.scm +16 -0
  119. package/out/hcl/injections.scm +6 -0
  120. package/out/html/folds.scm +5 -0
  121. package/out/html/indents.scm +1 -0
  122. package/out/html/locals.scm +1 -0
  123. package/out/ini/folds.scm +1 -0
  124. package/out/ini/highlights.scm +16 -0
  125. package/out/ini/injections.scm +3 -0
  126. package/out/ini/tree-sitter-ini.wasm +0 -0
  127. package/out/java/folds.scm +8 -0
  128. package/out/java/indents.scm +40 -0
  129. package/out/java/injections.scm +31 -0
  130. package/out/java/locals.scm +100 -0
  131. package/out/javascript/folds.scm +1 -0
  132. package/out/javascript/indents.scm +1 -0
  133. package/out/json/folds.scm +5 -0
  134. package/out/json/indents.scm +11 -0
  135. package/out/json/injections.scm +2 -0
  136. package/out/json/locals.scm +4 -0
  137. package/out/julia/folds.scm +14 -0
  138. package/out/julia/indents.scm +52 -0
  139. package/out/kotlin/folds.scm +13 -0
  140. package/out/kotlin/injections.scm +52 -0
  141. package/out/kotlin/locals.scm +78 -0
  142. package/out/lua/folds.scm +12 -0
  143. package/out/lua/indents.scm +47 -0
  144. package/out/markdown/folds.scm +12 -0
  145. package/out/markdown/indents.scm +1 -0
  146. package/out/matlab/folds.scm +13 -0
  147. package/out/matlab/highlights.scm +218 -0
  148. package/out/matlab/indents.scm +40 -0
  149. package/out/matlab/injections.scm +2 -0
  150. package/out/matlab/locals.scm +33 -0
  151. package/out/matlab/tree-sitter-matlab.wasm +0 -0
  152. package/out/nim/folds.scm +41 -0
  153. package/out/nim/highlights.scm +186 -0
  154. package/out/nim/injections.scm +79 -0
  155. package/out/nim/locals.scm +328 -0
  156. package/out/nim/tree-sitter-nim.wasm +0 -0
  157. package/out/nix/folds.scm +11 -0
  158. package/out/nix/indents.scm +75 -0
  159. package/out/ocaml/folds.scm +30 -0
  160. package/out/ocaml/indents.scm +77 -0
  161. package/out/ocaml/injections.scm +2 -0
  162. package/out/php/folds.scm +1 -0
  163. package/out/php/indents.scm +1 -0
  164. package/out/php/locals.scm +1 -0
  165. package/out/prisma/folds.scm +7 -0
  166. package/out/prisma/injections.scm +5 -0
  167. package/out/python/folds.scm +28 -0
  168. package/out/python/indents.scm +213 -0
  169. package/out/python/injections.scm +30 -0
  170. package/out/python/locals.scm +124 -0
  171. package/out/qmljs/folds.scm +8 -0
  172. package/out/qmljs/highlights.scm +61 -0
  173. package/out/qmljs/injections.scm +1 -0
  174. package/out/qmljs/locals.scm +6 -0
  175. package/out/qmljs/tree-sitter-qmljs.wasm +0 -0
  176. package/out/query/folds.scm +6 -0
  177. package/out/query/indents.scm +25 -0
  178. package/out/query/injections.scm +28 -0
  179. package/out/query/locals.scm +21 -0
  180. package/out/r/indents.scm +33 -0
  181. package/out/r/injections.scm +2 -0
  182. package/out/racket/folds.scm +2 -0
  183. package/out/racket/injections.scm +5 -0
  184. package/out/ruby/folds.scm +12 -0
  185. package/out/ruby/indents.scm +43 -0
  186. package/out/ruby/injections.scm +34 -0
  187. package/out/rust/folds.scm +25 -0
  188. package/out/rust/indents.scm +133 -0
  189. package/out/rust/locals.scm +98 -0
  190. package/out/scala/folds.scm +16 -0
  191. package/out/scala/injections.scm +5 -0
  192. package/out/scheme/folds.scm +2 -0
  193. package/out/scheme/injections.scm +2 -0
  194. package/out/scss/folds.scm +1 -0
  195. package/out/scss/indents.scm +7 -0
  196. package/out/scss/injections.scm +2 -0
  197. package/out/sql/folds.scm +1 -0
  198. package/out/sql/injections.scm +5 -0
  199. package/out/terraform/folds.scm +1 -0
  200. package/out/terraform/indents.scm +1 -0
  201. package/out/terraform/injections.scm +1 -0
  202. package/out/toml/folds.scm +5 -0
  203. package/out/toml/indents.scm +11 -0
  204. package/out/toml/injections.scm +2 -0
  205. package/out/toml/locals.scm +4 -0
  206. package/out/tsx/folds.scm +1 -0
  207. package/out/tsx/indents.scm +1 -0
  208. package/out/tsx/injections.scm +1 -0
  209. package/out/typescript/folds.scm +8 -0
  210. package/out/typescript/indents.scm +7 -0
  211. package/out/typescript/injections.scm +28 -0
  212. package/out/vim/folds.scm +4 -0
  213. package/out/vim/highlights.scm +362 -0
  214. package/out/vim/injections.scm +44 -0
  215. package/out/vim/locals.scm +19 -0
  216. package/out/vim/tree-sitter-vim.wasm +0 -0
  217. package/out/vimdoc/injections.scm +4 -0
  218. package/out/vue/folds.scm +6 -0
  219. package/out/vue/highlights.scm +54 -0
  220. package/out/vue/indents.scm +7 -0
  221. package/out/vue/injections.scm +78 -0
  222. package/out/vue/tree-sitter-vue.wasm +0 -0
  223. package/out/xml/folds.scm +5 -0
  224. package/out/xml/indents.scm +16 -0
  225. package/out/xml/injections.scm +32 -0
  226. package/out/xml/locals.scm +35 -0
  227. package/out/yaml/folds.scm +4 -0
  228. package/out/yaml/highlights.scm +79 -0
  229. package/out/yaml/indents.scm +7 -0
  230. package/out/yaml/injections.scm +81 -0
  231. package/out/yaml/locals.scm +9 -0
  232. package/out/yaml/tree-sitter-yaml.wasm +0 -0
  233. package/out/zig/locals.scm +96 -0
  234. package/package.json +49 -17
@@ -0,0 +1,77 @@
1
+ ; format-ignore
2
+ [
3
+ (let_binding) ; let = ...
4
+ (type_binding)
5
+
6
+ (external)
7
+ (record_declaration) ; { foo: bar ... }
8
+ (structure) ; struct ... end
9
+ (signature) ; sig ... end
10
+ (value_specification) ; val x: bar
11
+
12
+ (do_clause) ; do ... done
13
+ (match_case)
14
+
15
+ (field_expression)
16
+ (application_expression)
17
+ (parenthesized_expression) ; ( ... )
18
+ (record_expression) ; { foo = bar ... }
19
+ (list_expression) ; [...;...]
20
+ (try_expression) ; try ... with
21
+ ] @indent.begin
22
+
23
+ ; handle if-else if-else case
24
+ (if_expression
25
+ condition: (_) @indent.begin)
26
+
27
+ (then_clause) @indent.begin
28
+
29
+ ((else_clause
30
+ (_) @_not_if) @indent.begin
31
+ (#not-kind-eq? @_not_if "if_expression"))
32
+
33
+ ((parameter) @indent.begin
34
+ (#set! indent.start_at_same_line))
35
+
36
+ (_
37
+ (ERROR) @indent.begin
38
+ (#set! indent.start_at_same_line))
39
+
40
+ (ERROR
41
+ "|" @indent.begin
42
+ (#set! indent.start_at_same_line))
43
+
44
+ (try_expression
45
+ "with" @indent.branch
46
+ [
47
+ (match_case) @indent.dedent
48
+ (match_case
49
+ [
50
+ (parenthesized_expression)
51
+ (list_expression)
52
+ ] @indent.dedent)
53
+ ])
54
+
55
+ "}" @indent.branch @indent.end
56
+
57
+ (list_expression
58
+ "]" @indent.branch)
59
+
60
+ (parenthesized_expression
61
+ ")" @indent.branch)
62
+
63
+ ";;" @indent.end
64
+
65
+ (do_clause
66
+ "done" @indent.end @indent.branch)
67
+
68
+ (structure
69
+ "end" @indent.end @indent.branch)
70
+
71
+ (signature
72
+ "end" @indent.end @indent.branch)
73
+
74
+ [
75
+ (string)
76
+ (comment)
77
+ ] @indent.auto
@@ -0,0 +1,2 @@
1
+ ((comment) @injection.content
2
+ (#set! injection.language "comment"))
@@ -0,0 +1 @@
1
+ ; inherits: php_only
@@ -0,0 +1 @@
1
+ ; inherits: php_only
@@ -0,0 +1 @@
1
+ ; inherits: php_only
@@ -0,0 +1,7 @@
1
+ [
2
+ (generator_declaration)
3
+ (datasource_declaration)
4
+ (model_declaration)
5
+ (enum_declaration)
6
+ (view_declaration)
7
+ ] @fold
@@ -0,0 +1,5 @@
1
+ ([
2
+ (comment)
3
+ (developer_comment)
4
+ ] @injection.content
5
+ (#set! injection.language "comment"))
@@ -0,0 +1,28 @@
1
+ [
2
+ (function_definition)
3
+ (class_definition)
4
+ (while_statement)
5
+ (for_statement)
6
+ (if_statement)
7
+ (with_statement)
8
+ (try_statement)
9
+ (match_statement)
10
+ (import_from_statement)
11
+ (parameters)
12
+ (argument_list)
13
+ (parenthesized_expression)
14
+ (generator_expression)
15
+ (list_comprehension)
16
+ (set_comprehension)
17
+ (dictionary_comprehension)
18
+ (tuple)
19
+ (list)
20
+ (set)
21
+ (dictionary)
22
+ (string)
23
+ ] @fold
24
+
25
+ [
26
+ (import_statement)
27
+ (import_from_statement)
28
+ ]+ @fold
@@ -0,0 +1,213 @@
1
+ [
2
+ (import_from_statement)
3
+ (generator_expression)
4
+ (list_comprehension)
5
+ (set_comprehension)
6
+ (dictionary_comprehension)
7
+ (tuple_pattern)
8
+ (list_pattern)
9
+ (binary_operator)
10
+ (lambda)
11
+ (concatenated_string)
12
+ ] @indent.begin
13
+
14
+ ((list) @indent.align
15
+ (#set! indent.open_delimiter "[")
16
+ (#set! indent.close_delimiter "]"))
17
+
18
+ ((dictionary) @indent.align
19
+ (#set! indent.open_delimiter "{")
20
+ (#set! indent.close_delimiter "}"))
21
+
22
+ ((set) @indent.align
23
+ (#set! indent.open_delimiter "{")
24
+ (#set! indent.close_delimiter "}"))
25
+
26
+ ((parenthesized_expression) @indent.align
27
+ (#set! indent.open_delimiter "(")
28
+ (#set! indent.close_delimiter ")"))
29
+
30
+ ((for_statement) @indent.begin
31
+ (#set! indent.immediate 1))
32
+
33
+ ((if_statement) @indent.begin
34
+ (#set! indent.immediate 1))
35
+
36
+ ((while_statement) @indent.begin
37
+ (#set! indent.immediate 1))
38
+
39
+ ((try_statement) @indent.begin
40
+ (#set! indent.immediate 1))
41
+
42
+ (ERROR
43
+ "try"
44
+ .
45
+ ":"
46
+ (#set! indent.immediate 1)) @indent.begin
47
+
48
+ (ERROR
49
+ "try"
50
+ .
51
+ ":"
52
+ (ERROR
53
+ (block
54
+ (expression_statement
55
+ (identifier) @_except) @indent.branch))
56
+ (#eq? @_except "except"))
57
+
58
+ ((function_definition) @indent.begin
59
+ (#set! indent.immediate 1))
60
+
61
+ ((class_definition) @indent.begin
62
+ (#set! indent.immediate 1))
63
+
64
+ ((with_statement) @indent.begin
65
+ (#set! indent.immediate 1))
66
+
67
+ ((match_statement) @indent.begin
68
+ (#set! indent.immediate 1))
69
+
70
+ ((case_clause) @indent.begin
71
+ (#set! indent.immediate 1))
72
+
73
+ ; if (cond1
74
+ ; or cond2
75
+ ; or cond3):
76
+ ; pass
77
+ ;
78
+ (if_statement
79
+ condition: (parenthesized_expression) @indent.align
80
+ (#lua-match? @indent.align "^%([^\n]")
81
+ (#set! indent.open_delimiter "(")
82
+ (#set! indent.close_delimiter ")")
83
+ (#set! indent.avoid_last_matching_next 1))
84
+
85
+ ; while (
86
+ ; cond1
87
+ ; or cond2
88
+ ; or cond3):
89
+ ; pass
90
+ ;
91
+ (while_statement
92
+ condition: (parenthesized_expression) @indent.align
93
+ (#lua-match? @indent.align "[^\n ]%)$")
94
+ (#set! indent.open_delimiter "(")
95
+ (#set! indent.close_delimiter ")")
96
+ (#set! indent.avoid_last_matching_next 1))
97
+
98
+ ; if (
99
+ ; cond1
100
+ ; or cond2
101
+ ; or cond3):
102
+ ; pass
103
+ ;
104
+ (if_statement
105
+ condition: (parenthesized_expression) @indent.align
106
+ (#lua-match? @indent.align "[^\n ]%)$")
107
+ (#set! indent.open_delimiter "(")
108
+ (#set! indent.close_delimiter ")")
109
+ (#set! indent.avoid_last_matching_next 1))
110
+
111
+ (ERROR
112
+ "(" @indent.align
113
+ (#set! indent.open_delimiter "(")
114
+ (#set! indent.close_delimiter ")")
115
+ .
116
+ (_))
117
+
118
+ ((argument_list) @indent.align
119
+ (#set! indent.open_delimiter "(")
120
+ (#set! indent.close_delimiter ")"))
121
+
122
+ ((parameters) @indent.align
123
+ (#set! indent.open_delimiter "(")
124
+ (#set! indent.close_delimiter ")"))
125
+
126
+ ((parameters) @indent.align
127
+ (#lua-match? @indent.align "[^\n ]%)$")
128
+ (#set! indent.open_delimiter "(")
129
+ (#set! indent.close_delimiter ")")
130
+ (#set! indent.avoid_last_matching_next 1))
131
+
132
+ ((tuple) @indent.align
133
+ (#set! indent.open_delimiter "(")
134
+ (#set! indent.close_delimiter ")"))
135
+
136
+ (ERROR
137
+ "[" @indent.align
138
+ (#set! indent.open_delimiter "[")
139
+ (#set! indent.close_delimiter "]")
140
+ .
141
+ (_))
142
+
143
+ (ERROR
144
+ "{" @indent.align
145
+ (#set! indent.open_delimiter "{")
146
+ (#set! indent.close_delimiter "}")
147
+ .
148
+ (_))
149
+
150
+ [
151
+ (break_statement)
152
+ (continue_statement)
153
+ ] @indent.dedent
154
+
155
+ (ERROR
156
+ (_) @indent.branch
157
+ ":"
158
+ .
159
+ (#lua-match? @indent.branch "^else"))
160
+
161
+ (ERROR
162
+ (_) @indent.branch @indent.dedent
163
+ ":"
164
+ .
165
+ (#lua-match? @indent.branch "^elif"))
166
+
167
+ (generator_expression
168
+ ")" @indent.end)
169
+
170
+ (list_comprehension
171
+ "]" @indent.end)
172
+
173
+ (set_comprehension
174
+ "}" @indent.end)
175
+
176
+ (dictionary_comprehension
177
+ "}" @indent.end)
178
+
179
+ (tuple_pattern
180
+ ")" @indent.end)
181
+
182
+ (list_pattern
183
+ "]" @indent.end)
184
+
185
+ (return_statement
186
+ [
187
+ (_) @indent.end
188
+ (_
189
+ [
190
+ (_)
191
+ ")"
192
+ "}"
193
+ "]"
194
+ ] @indent.end .)
195
+ (attribute
196
+ attribute: (_) @indent.end)
197
+ (call
198
+ arguments: (_
199
+ ")" @indent.end))
200
+ "return" @indent.end
201
+ ] .)
202
+
203
+ [
204
+ ")"
205
+ "]"
206
+ "}"
207
+ (elif_clause)
208
+ (else_clause)
209
+ (except_clause)
210
+ (finally_clause)
211
+ ] @indent.branch
212
+
213
+ (string) @indent.auto
@@ -0,0 +1,30 @@
1
+ (call
2
+ function: (attribute
3
+ object: (identifier) @_re)
4
+ arguments: (argument_list
5
+ (string
6
+ (string_content) @injection.content))
7
+ (#eq? @_re "re")
8
+ (#set! injection.language "regex"))
9
+
10
+ (call
11
+ function: (attribute
12
+ object: (identifier) @_re)
13
+ arguments: (argument_list
14
+ (concatenated_string
15
+ [
16
+ (string
17
+ (string_content) @injection.content)
18
+ (comment)
19
+ ]+))
20
+ (#eq? @_re "re")
21
+ (#set! injection.language "regex"))
22
+
23
+ ((binary_operator
24
+ left: (string
25
+ (string_content) @injection.content)
26
+ operator: "%")
27
+ (#set! injection.language "printf"))
28
+
29
+ ((comment) @injection.content
30
+ (#set! injection.language "comment"))
@@ -0,0 +1,124 @@
1
+ ; Program structure
2
+ (module) @local.scope
3
+
4
+ (class_definition
5
+ body: (block
6
+ (expression_statement
7
+ (assignment
8
+ left: (identifier) @local.definition.field)))) @local.scope
9
+
10
+ (class_definition
11
+ body: (block
12
+ (expression_statement
13
+ (assignment
14
+ left: (_
15
+ (identifier) @local.definition.field))))) @local.scope
16
+
17
+ ; Imports
18
+ (aliased_import
19
+ alias: (identifier) @local.definition.import) @local.scope
20
+
21
+ (import_statement
22
+ name: (dotted_name
23
+ (identifier) @local.definition.import)) @local.scope
24
+
25
+ (import_from_statement
26
+ name: (dotted_name
27
+ (identifier) @local.definition.import)) @local.scope
28
+
29
+ ; Function with parameters, defines parameters
30
+ (parameters
31
+ (identifier) @local.definition.parameter)
32
+
33
+ (default_parameter
34
+ (identifier) @local.definition.parameter)
35
+
36
+ (typed_parameter
37
+ (identifier) @local.definition.parameter)
38
+
39
+ (typed_default_parameter
40
+ (identifier) @local.definition.parameter)
41
+
42
+ ; *args parameter
43
+ (parameters
44
+ (list_splat_pattern
45
+ (identifier) @local.definition.parameter))
46
+
47
+ ; **kwargs parameter
48
+ (parameters
49
+ (dictionary_splat_pattern
50
+ (identifier) @local.definition.parameter))
51
+
52
+ ; Function defines function and scope
53
+ ((function_definition
54
+ name: (identifier) @local.definition.function) @local.scope
55
+ (#set! definition.function.scope "parent"))
56
+
57
+ ((class_definition
58
+ name: (identifier) @local.definition.type) @local.scope
59
+ (#set! definition.type.scope "parent"))
60
+
61
+ (class_definition
62
+ body: (block
63
+ (function_definition
64
+ name: (identifier) @local.definition.method)))
65
+
66
+ ; Loops
67
+ ; not a scope!
68
+ (for_statement
69
+ left: (pattern_list
70
+ (identifier) @local.definition.var))
71
+
72
+ (for_statement
73
+ left: (tuple_pattern
74
+ (identifier) @local.definition.var))
75
+
76
+ (for_statement
77
+ left: (identifier) @local.definition.var)
78
+
79
+ ; not a scope!
80
+ ;(while_statement) @local.scope
81
+ ; for in list comprehension
82
+ (for_in_clause
83
+ left: (identifier) @local.definition.var)
84
+
85
+ (for_in_clause
86
+ left: (tuple_pattern
87
+ (identifier) @local.definition.var))
88
+
89
+ (for_in_clause
90
+ left: (pattern_list
91
+ (identifier) @local.definition.var))
92
+
93
+ (dictionary_comprehension) @local.scope
94
+
95
+ (list_comprehension) @local.scope
96
+
97
+ (set_comprehension) @local.scope
98
+
99
+ ; Assignments
100
+ (assignment
101
+ left: (identifier) @local.definition.var)
102
+
103
+ (assignment
104
+ left: (pattern_list
105
+ (identifier) @local.definition.var))
106
+
107
+ (assignment
108
+ left: (tuple_pattern
109
+ (identifier) @local.definition.var))
110
+
111
+ (assignment
112
+ left: (attribute
113
+ (identifier)
114
+ (identifier) @local.definition.field))
115
+
116
+ ; Walrus operator x := 1
117
+ (named_expression
118
+ (identifier) @local.definition.var)
119
+
120
+ (as_pattern
121
+ alias: (as_pattern_target) @local.definition.var)
122
+
123
+ ; REFERENCES
124
+ (identifier) @local.reference
@@ -0,0 +1,8 @@
1
+ [
2
+ (ui_object_definition)
3
+ (function_declaration)
4
+ (statement_block)
5
+ (if_statement)
6
+ (ui_binding)
7
+ (comment)
8
+ ] @fold
@@ -0,0 +1,61 @@
1
+ ;;; Annotations
2
+
3
+ (ui_annotation
4
+ "@" @operator
5
+ type_name: [
6
+ (identifier) @attribute
7
+ (nested_identifier (identifier) @attribute)
8
+ ])
9
+
10
+ ;;; Properties
11
+
12
+ (ui_object_definition_binding
13
+ name: [
14
+ (identifier) @property
15
+ (nested_identifier (identifier) @property)
16
+ ])
17
+
18
+ (ui_binding
19
+ name: [
20
+ (identifier) @property
21
+ (nested_identifier (identifier) @property)
22
+ ])
23
+
24
+ ;; locals query appears not working unless id: <ref> isn't a parameter.
25
+ (ui_binding
26
+ name: (identifier) @property
27
+ (#eq? @property "id")
28
+ value: (expression_statement (identifier) @variable.parameter))
29
+
30
+ (ui_property
31
+ name: (identifier) @property)
32
+
33
+ (ui_required
34
+ name: (identifier) @property)
35
+
36
+ (ui_list_property_type
37
+ ["<" ">"] @punctuation.bracket)
38
+
39
+ ;;; Signals
40
+
41
+ (ui_signal
42
+ name: (identifier) @function.signal)
43
+
44
+ (ui_signal_parameter
45
+ (identifier) @variable.parameter)
46
+
47
+ ;;; Keywords
48
+
49
+ [
50
+ "as"
51
+ "component"
52
+ "default"
53
+ "final"
54
+ "import"
55
+ "on"
56
+ "pragma"
57
+ "property"
58
+ "readonly"
59
+ "required"
60
+ "signal"
61
+ ] @keyword
@@ -0,0 +1 @@
1
+ ; inherits: ecma
@@ -0,0 +1,6 @@
1
+ ;;; Definitions
2
+
3
+ (ui_binding
4
+ name: (identifier) @property
5
+ (#eq? @property "id")
6
+ value: (expression_statement (identifier) @local.definition))
Binary file
@@ -0,0 +1,6 @@
1
+ [
2
+ (named_node)
3
+ (predicate)
4
+ (grouping)
5
+ (list)
6
+ ] @fold
@@ -0,0 +1,25 @@
1
+ [
2
+ (list)
3
+ (named_node)
4
+ (grouping)
5
+ (predicate)
6
+ "["
7
+ ] @indent.begin
8
+
9
+ ; ERROR node indents
10
+ (ERROR
11
+ "(") @indent.begin
12
+
13
+ "]" @indent.branch @indent.end
14
+
15
+ [
16
+ ")"
17
+ "?"
18
+ "*"
19
+ "+"
20
+ ] @indent.end
21
+
22
+ ; Captures always mark the end of a node
23
+ ; Because of that, mark it as indent.end
24
+ (capture
25
+ name: (identifier) @indent.end)
@@ -0,0 +1,28 @@
1
+ ((predicate
2
+ name: (identifier) @_name
3
+ parameters: (parameters
4
+ (string
5
+ (string_content) @injection.content)))
6
+ (#any-of? @_name "match" "not-match" "any-match" "vim-match" "not-vim-match" "any-vim-match")
7
+ (#set! injection.language "regex"))
8
+
9
+ ((predicate
10
+ name: (identifier) @_name
11
+ parameters: (parameters
12
+ (string
13
+ (string_content) @injection.content)))
14
+ (#any-of? @_name "lua-match" "not-lua-match" "any-lua-match")
15
+ (#set! injection.language "luap"))
16
+
17
+ ((predicate
18
+ name: (identifier) @_name
19
+ parameters: (parameters
20
+ (string
21
+ (string_content) @injection.content)
22
+ .
23
+ (string) .))
24
+ (#any-of? @_name "gsub" "not-gsub")
25
+ (#set! injection.language "luap"))
26
+
27
+ ((comment) @injection.content
28
+ (#set! injection.language "comment"))
@@ -0,0 +1,21 @@
1
+ (program) @local.scope
2
+
3
+ (program
4
+ (named_node) @local.scope)
5
+
6
+ (program
7
+ (anonymous_node) @local.scope)
8
+
9
+ (program
10
+ (grouping) @local.scope)
11
+
12
+ (identifier) @local.reference
13
+
14
+ (named_node
15
+ (capture) @local.definition.var)
16
+
17
+ (anonymous_node
18
+ (capture) @local.definition.var)
19
+
20
+ (grouping
21
+ (capture) @local.definition.var)
@@ -0,0 +1,33 @@
1
+ [
2
+ (braced_expression)
3
+ (parenthesized_expression)
4
+ (call)
5
+ "if"
6
+ "else"
7
+ "while"
8
+ "repeat"
9
+ "for"
10
+ ] @indent.begin
11
+
12
+ (binary_operator
13
+ rhs: (_) @_no_indent
14
+ (#not-kind-eq? @_no_indent function_definition)) @indent.begin
15
+
16
+ [
17
+ "}"
18
+ ")"
19
+ ] @indent.branch
20
+
21
+ ((parameters
22
+ .
23
+ (parameter
24
+ name: (identifier))) @indent.align
25
+ (#set! indent.open_delimiter "(")
26
+ (#set! indent.close_delimiter ")"))
27
+
28
+ [
29
+ ")"
30
+ "}"
31
+ ] @indent.end
32
+
33
+ (comment) @indent.ignore
@@ -0,0 +1,2 @@
1
+ ((comment) @injection.content
2
+ (#set! injection.language "comment"))