Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ commit = "c70c1de07dedd532089c0c90835c8ed9fa694f5c"

[grammars.rbs]
repository = "https://github.com/joker1007/tree-sitter-rbs"
commit = "de893b166476205b09e79cd3689f95831269579a"
commit = "6bcfa169021a9cc40fb47cd75ef4b4d3767d6ab5"

[[capabilities]]
kind = "process:exec"
Expand Down
3 changes: 3 additions & 0 deletions languages/rbs/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,6 @@
","
"."
] @punctuation.delimiter

; RBS Inline prefix (keep comment color)
(inline_prefix) @comment
5 changes: 4 additions & 1 deletion languages/ruby/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@
(nil)
] @constant.builtin

(comment) @comment
; Regular comments (exclude RBS inline comments)
((comment) @comment
(#not-match? @comment "^\\s*#[:|]")
(#not-match? @comment "^\\s*#\\s*(@rbs|\\|)"))

; Operators

Expand Down
17 changes: 17 additions & 0 deletions languages/ruby/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,22 @@
(string_content) @content)
(#set! "language" "regex"))

; RBS Inline: #: syntax
((comment) @content
(#match? @content "^\\s*#:")
(#set! injection.language "rbs"))

; RBS Inline: # @rbs syntax
((comment) @content
(#match? @content "^\\s*#\\s*@rbs")
(#set! injection.language "rbs"))

; RBS Inline: continuation lines (e.g., "#| param: Type" or "# | (?Regexp?) -> void")
; Note: These will parse with errors since they're not complete RBS on their own,
; but types within them will still get highlighted
((comment) @content
(#match? @content "^\\s*#\\s*\\|")
(#set! injection.language "rbs"))

((comment) @content
(#set! injection.language "comment"))