Skip to content

Conversation

@vitallium
Copy link
Collaborator

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.

@cla-bot cla-bot bot added the cla-signed label May 10, 2025
@vitallium
Copy link
Collaborator Author

Merging this PR also requires updating the Ruby extension documentation (https://zed.dev/docs/languages/ruby#running-tests). In the minitest section, we need to replace instances of ZED_SYMBOL with ZED_CUSTOM_name.

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.
@vitallium vitallium force-pushed the vs/expose-runnables-captures branch from bc2f065 to 7cbb44e Compare May 10, 2025 07:16
@vitallium vitallium merged commit 0d06487 into main May 11, 2025
3 checks passed
@vitallium vitallium deleted the vs/expose-runnables-captures branch May 11, 2025 12:40
@vitallium vitallium mentioned this pull request Jun 2, 2025
vitallium added a commit that referenced this pull request Jun 2, 2025
- Expose `runnables` captures (#94)
- Update Rust crate `zed_extension_api` to 0.5.0 (#86)
- ruby: Update tasks format (#100)
- ruby: Add .irbrc to language config (#101)

Bumped the version to v0.8.0 due to an upgrade of the Rust crate
`zed_extension_api`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants