Skip to content

fix(ruby): adjust operator highlights - #338

Merged
vitallium merged 9 commits into
zed-extensions:mainfrom
AlternateRT:adjust-operator-highlights
Sep 23, 2026
Merged

vitallium merged 9 commits into
zed-extensions:mainfrom
AlternateRT:adjust-operator-highlights

Conversation

@AlternateRT

@AlternateRT AlternateRT commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Stop capturing most of these from just the bare token and instead capture them when defined in the operator: field

The previous way erroneously highlighted some of them as operator when used elsewhere - e.g. / and | are also used as delimiters for the regex literal and block parameters respectively

Also adds some missing highlights for the not, ?, and : operators

@cla-bot cla-bot Bot added the cla-signed label Sep 19, 2026
@AlternateRT
AlternateRT force-pushed the adjust-operator-highlights branch from de01586 to 6f1a85a Compare September 19, 2026 16:26
Stop capturing most of these from just the bare token and instead
capture them when defined in the `operator:` field

The previous way erroneously highlighted some of them as operator when
used elsewhere - e.g. `/` and `|` are also used as delimiters for the
regex literal and block parameters respectively

Also adds some missing highlights for the `not`, `?`, and `:` operators
@AlternateRT
AlternateRT force-pushed the adjust-operator-highlights branch from 6f1a85a to af609ad Compare September 19, 2026 16:28

@vitallium vitallium left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I left some questions and suggestions. Additionally, it would be nice to add some regression tests to ensure that the changes introduced in this MR aren't broken by future changes.

Thanks!

Comment thread languages/ruby/highlights.scm Outdated
Comment thread languages/ruby/highlights.scm
Comment thread languages/ruby/highlights.scm
Comment thread languages/ruby/highlights.scm
And remove bare captures for `>>` and `>` that are already covered by
the `(_ operator: _ @operator)` capture
Also ensure that the highlights for `keyword_parameter` are applied
when the node appears inside a `lambda_parameters` or
`block_parameters` node, and adjust the highlight of delimited hash key
symbols, which is a `string` node whose parent is either `pair` or
`keyword_pattern`
@AlternateRT
AlternateRT force-pushed the adjust-operator-highlights branch 4 times, most recently from ac32ef9 to 688afe1 Compare September 22, 2026 15:49
@AlternateRT
AlternateRT force-pushed the adjust-operator-highlights branch from 688afe1 to 09e3124 Compare September 22, 2026 16:00
@vitallium

Copy link
Copy Markdown
Collaborator

@AlternateRT thanks again for your hard work here! Happy to merge this PR!

@vitallium
vitallium merged commit 83b7d37 into zed-extensions:main Sep 23, 2026
5 checks passed
@AlternateRT
AlternateRT deleted the adjust-operator-highlights branch September 23, 2026 18:36
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