Skip to content

Commit 0d06487

Browse files
authored
Expose runnables captures (#94)
Exposing `runnables` captures makes them available as Zed template variables. Each capture is mapped to a Zed variable in the format: ``` ZED_CUSTOM_$(capture_name) ``` For example, consider this query: ``` ( (call method: (identifier) @name) ) ``` This exposes the `@name` capture, which can then be referenced in Zed templates as: ``` $ZED_CUSTOM_name ``` Key notes: - Case Sensitivity: The syntax is case-sensitive. Ensure matches between capture names (e.g., `@name`) and variable references (e.g., `$ZED_CUSTOM_name`). - Underscores: Captures prefixed with underscores (e.g., `@_ruby-test`) are not mapped to Zed variables.
1 parent 6bbadba commit 0d06487

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

languages/ruby/runnables.scm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
(
1818
(call
1919
method: (identifier) @run (#eq? @run "test")
20-
arguments: (argument_list (string (string_content) @_name))
20+
arguments: (argument_list (string (string_content) @name))
2121
) @_ruby-test
2222
(#set! tag ruby-test)
2323
)
@@ -42,7 +42,7 @@
4242
(
4343
(call
4444
method: (identifier) @run (#any-of? @run "describe" "context" "it" "its" "specify")
45-
arguments: (argument_list . (_) @_name)
45+
arguments: (argument_list . (_) @name)
4646
) @_ruby-test
4747
(#set! tag ruby-test)
4848
)
@@ -51,7 +51,7 @@
5151
(
5252
(call
5353
method: (identifier) @run (#any-of? @run "it" "its" "specify")
54-
block: (_) @_name
54+
block: (_) @name
5555
!arguments
5656
) @_ruby-test
5757
(#set! tag ruby-test)

0 commit comments

Comments
 (0)