From d009fe41938a674a79ca04eac8b7c996eb5272e8 Mon Sep 17 00:00:00 2001 From: Slobodan Erak Date: Tue, 23 Jun 2026 18:19:04 -0400 Subject: [PATCH] Highlight instance vars, method defs, and keyword params distinctly These three constructs are folded into broader shared captures, so themes cannot color them independently: - instance variables share `@variable.special` with `self`, `super`, and class variables - method definitions share `@function.method` with method calls - keyword parameters share `@variable.parameter` with positional parameters Give each its own dotted sub-scope, following the sub-scoping convention already used throughout this file (e.g. `function.method.builtin`, `keyword.control.conditional`, `string.special.symbol`): - (instance_variable) -> @variable.special.instance - method / singleton_method -> @function.method.definition - keyword_parameter -> @variable.parameter.keyword Fully backwards-compatible: Zed resolves highlight names by longest prefix, so themes that only define `variable.special`, `function.method`, or `variable.parameter` render these exactly as before. Themes can now opt in to distinguishing them. --- languages/ruby/highlights.scm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/languages/ruby/highlights.scm b/languages/ruby/highlights.scm index 2f97044..139c872 100644 --- a/languages/ruby/highlights.scm +++ b/languages/ruby/highlights.scm @@ -81,13 +81,13 @@ name: [ (identifier) (constant) - ] @function.method) + ] @function.method.definition) (singleton_method name: [ (identifier) (constant) - ] @function.method) + ] @function.method.definition) (method_parameters [ @@ -98,7 +98,7 @@ [ name: (identifier) ":" - ] @variable.parameter) + ] @variable.parameter.keyword) ]) (block_parameters @@ -138,10 +138,9 @@ (super) @variable.special -[ - (class_variable) - (instance_variable) -] @variable.special +(class_variable) @variable.special + +(instance_variable) @variable.special.instance ((call !receiver