Skip to content

Commit 430f15b

Browse files
authored
chore(ruby): prefix tree-sitter captures with underscore (#198)
Add underscore prefix to tree-sitter capture variables that are used only for matching conditions. Closes #177
1 parent abd9665 commit 430f15b

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

languages/ruby/outline.scm

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
; Root test methods
165165
(program
166166
(call
167-
method: (identifier) @run @name (#any-of? @run "describe" "context" "test" "it" "shared_examples")
167+
method: (identifier) @_run @name (#any-of? @_run "describe" "context" "test" "it" "shared_examples")
168168
arguments: (argument_list . [
169169
(string) @name
170170
(simple_symbol) @name
@@ -183,7 +183,7 @@
183183

184184
; Nested test methods
185185
(call
186-
method: (identifier) @ctx (#any-of? @ctx "describe" "context" "shared_examples")
186+
method: (identifier) @_ctx (#any-of? @_ctx "describe" "context" "shared_examples")
187187
arguments: (argument_list . [
188188
(string)
189189
(simple_symbol)
@@ -194,7 +194,7 @@
194194
block: (_
195195
(_
196196
(call
197-
method: (identifier) @run @name (#any-of? @run "describe" "context" "test" "it" "shared_examples")
197+
method: (identifier) @_run @name (#any-of? @_run "describe" "context" "test" "it" "shared_examples")
198198
arguments: (argument_list . [
199199
(string) @name
200200
(simple_symbol) @name
@@ -215,7 +215,7 @@
215215

216216
; RSpec one-liners
217217
(call
218-
method: (identifier) @ctx (#any-of? @ctx "describe" "context" "shared_examples")
218+
method: (identifier) @_ctx (#any-of? @_ctx "describe" "context" "shared_examples")
219219
arguments: (argument_list . [
220220
(string)
221221
(simple_symbol)
@@ -226,12 +226,12 @@
226226
block: (_
227227
(_
228228
(call
229-
method: (identifier) @run @name (#any-of? @run "it")
229+
method: (identifier) @_run @name (#any-of? @_run "it")
230230
block: (block
231231
body: (block_body
232232
(call
233-
receiver: (identifier) @expectation (#any-of? @expectation "is_expected")
234-
method: (identifier) @negation (#any-of? @negation "to" "not_to" "to_not")
233+
receiver: (identifier) @_expectation (#any-of? @_expectation "is_expected")
234+
method: (identifier) @_negation (#any-of? @_negation "to" "not_to" "to_not")
235235
)
236236
)
237237
) @name
@@ -243,7 +243,7 @@
243243
; Root rake namespace
244244
(program
245245
(call
246-
method: (identifier) @namespace @name (#any-of? @namespace "namespace")
246+
method: (identifier) @_namespace @name (#any-of? @_namespace "namespace")
247247
arguments: (argument_list . [
248248
(string) @name
249249
(simple_symbol) @name
@@ -254,7 +254,7 @@
254254

255255
; Nested rake namespace
256256
(call
257-
method: (identifier) @parent_namespace (#any-of? @parent_namespace "namespace")
257+
method: (identifier) @_parent_namespace (#any-of? @_parent_namespace "namespace")
258258
arguments: (argument_list . [
259259
(string)
260260
(simple_symbol)
@@ -263,7 +263,7 @@
263263
block: (_
264264
(_
265265
(call
266-
method: (identifier) @namespace @name (#any-of? @namespace "namespace")
266+
method: (identifier) @_namespace @name (#any-of? @_namespace "namespace")
267267
arguments: (argument_list . [
268268
(string) @name
269269
(simple_symbol) @name
@@ -277,7 +277,7 @@
277277
; Root rake task
278278
(program
279279
(call
280-
method: (identifier) @task @name (#any-of? @task "task")
280+
method: (identifier) @_task @name (#any-of? @_task "task")
281281
arguments: (argument_list . [
282282
(string) @name
283283
(simple_symbol) @name
@@ -291,7 +291,7 @@
291291

292292
; Nested rake task
293293
(call
294-
method: (identifier) @namespace (#any-of? @namespace "namespace")
294+
method: (identifier) @_namespace (#any-of? @_namespace "namespace")
295295
arguments: (argument_list . [
296296
(string)
297297
(simple_symbol)
@@ -300,7 +300,7 @@
300300
block: (_
301301
(_
302302
(call
303-
method: (identifier) @task @name (#any-of? @task "task")
303+
method: (identifier) @_task @name (#any-of? @_task "task")
304304
arguments: (argument_list . [
305305
(string) @name
306306
(simple_symbol) @name

0 commit comments

Comments
 (0)