feat(rbs): Add highlight rules for inline annotations#262
feat(rbs): Add highlight rules for inline annotations#262hakanensari wants to merge 1 commit intozed-extensions:mainfrom
Conversation
Add highlight rules from upstream tree-sitter-rbs for: - Generic modifiers (unchecked, out, in) - Unnamed parameters - Inline annotation keywords (inherits, generic, override, skip) - Inline doc comments and parameter names - Missing operators (?, *, **, &)
There was a problem hiding this comment.
Pull request overview
Adds missing Tree-sitter highlight query rules for RBS inline annotation syntax (e.g., #: / # @rbs) to improve highlighting when RBS is injected into Ruby comments.
Changes:
- Add highlight captures for generics-related keywords/modifiers and unnamed parameters.
- Extend operator highlighting to cover additional inline-annotation operator forms.
- Add highlight captures for inline annotation keywords and inline doc comment structures.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| ; Generics Keywords | ||
| [ | ||
| (generics_unchecked) | ||
| (generics_variance) | ||
| ] @keyword | ||
|
|
There was a problem hiding this comment.
There are snapshot-based query tests for Ruby/ERB, but none for RBS. As a result, these new RBS highlight patterns (e.g., generics_unchecked, inline_*, and the operator nodes) are not validated by cargo test, so a node-name mismatch with the pinned tree-sitter-rbs grammar could ship and break RBS highlighting/injections at runtime. Consider adding an RBS query snapshot test by wiring rbs into tests/support/language_for_id (and adding tree-sitter-rbs as a dev-dependency) plus a small tests/languages/rbs fixture that exercises the inline annotation syntax.


Summary
#:and# @rbscomments)unchecked,out,in), unnamed parameters, inline keywords (inherits,generic,override,skip), doc comments, and operators (?,*,**,&)Test plan
cargo testpasses (60 tests, no changes to test fixtures)