Skip to content

RBS Inline Syntax Highlighting #204

@marcoroth

Description

@marcoroth

I've been trying to bring this feature over to Zed: Shopify/ruby-lsp#3215

Here are some Tree Sitter Queries to match the comments:

; RBS Inline: #: syntax
((comment) @content
  (#match? @content "^#:")
  (#set! "language" "rbs"))

; RBS Inline: #| continuation syntax
((comment) @content
  (#match? @content "^#\\|")
  (#set! "language" "rbs"))

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

I tried adding them to languages/ruby/injections.scm, tried to unmatch the RBS Inline comments languages/ruby/overrides.scm and languages/ruby/highlights.scm but I couldn't get it to work.

Also using (#set! injection.language "rbs")) and uppercase "RBS" doesn't work either. Initially I thought we might have to use #offset to make sure are strip out the #:, #|, or # @rbs but it doesn't seem to make a difference.

But maybe I'm missing something to make it work, which is why I'm opening this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions