Skip to content

Commit 5309108

Browse files
authored
feat(rbs): Add highlight rules for inline annotations (#262)
## Summary - Add missing highlight rules from upstream tree-sitter-rbs for RBS inline annotations (`#:` and `# @rbs` comments) - Highlights generic modifiers (`unchecked`, `out`, `in`), unnamed parameters, inline keywords (`inherits`, `generic`, `override`, `skip`), doc comments, and operators (`?`, `*`, `**`, `&`) - All capture names follow existing conventions in the file ## Test plan - [x] `cargo test` passes (60 tests, no changes to test fixtures) - [x] Manually verify RBS inline annotation highlighting in Zed
1 parent 1db992e commit 5309108

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

languages/rbs/highlights.scm

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,22 @@
107107

108108
(global_name) @variable
109109

110+
; Generics Keywords
111+
[
112+
(generics_unchecked)
113+
(generics_variance)
114+
] @keyword
115+
110116
; Standard Arguments
111117
(parameter
112118
(var_name) @variable.parameter)
113119

114120
; Keyword Arguments
115121
(keyword) @variable.parameter
116122

123+
; Unnamed Arguments
124+
(unnamed_parameter) @variable.parameter
125+
117126
; Self
118127
(self) @variable.builtin
119128

@@ -145,6 +154,10 @@
145154
"&"
146155
"|"
147156
"^"
157+
"?"
158+
(rest_operator)
159+
(block_operator)
160+
(optional_block_operator)
148161
] @operator
149162

150163
; Punctuation
@@ -164,3 +177,19 @@
164177

165178
; RBS Inline prefix (keep comment color)
166179
(inline_prefix) @comment
180+
181+
; RBS Inline keywords
182+
(inline_class_annotation) @keyword
183+
184+
(inline_generic) @keyword
185+
186+
(inline_override) @keyword
187+
188+
(inline_skip) @keyword
189+
190+
; RBS Inline doc comment (-- description)
191+
(inline_doc_comment) @comment
192+
193+
; RBS Inline doc param names (e.g. @rbs client_request_token: String)
194+
(inline_doc
195+
(var_name) @variable.parameter)

0 commit comments

Comments
 (0)