From ff9a70663ba6d0cdb3a222f16768591e34ea9448 Mon Sep 17 00:00:00 2001 From: Vitaly Slobodin Date: Sat, 29 Aug 2026 22:34:39 +0200 Subject: [PATCH 1/2] fix(ruby): scope string overrides to literal content The Ruby extension currently applies the string scope to the entire string node. This includes Ruby interpolation expressions. Limit the scope to string content instead. Keep interpolation expressions in the normal Ruby scope. This keeps string-specific settings, such as Tailwind language-server opt-in and completion query characters, inside literal string content. Closes https://github.com/zed-extensions/ruby/issues/313 --- languages/ruby/overrides.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/languages/ruby/overrides.scm b/languages/ruby/overrides.scm index 544e987..d3d4b61 100644 --- a/languages/ruby/overrides.scm +++ b/languages/ruby/overrides.scm @@ -1,3 +1,4 @@ (comment) @comment.inclusive -(string) @string +(string + (string_content) @string.inclusive) From 85abfb4fb527b53c6b046684e5f7b1ec85b2fba6 Mon Sep 17 00:00:00 2001 From: Vitaly Slobodin Date: Sat, 29 Aug 2026 22:40:31 +0200 Subject: [PATCH 2/2] test(ruby): add overrides snapshots --- tests/languages/ruby/overrides.rb | 6 ++++++ tests/languages/ruby/snapshots/overrides.snap | 20 +++++++++++++++++++ tests/ruby.rs | 13 ++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 tests/languages/ruby/overrides.rb create mode 100644 tests/languages/ruby/snapshots/overrides.snap diff --git a/tests/languages/ruby/overrides.rb b/tests/languages/ruby/overrides.rb new file mode 100644 index 0000000..36aa447 --- /dev/null +++ b/tests/languages/ruby/overrides.rb @@ -0,0 +1,6 @@ +# A Ruby comment +plain_string = "plain text" +interpolated_string = "hello #{user.name}" +single_quoted_string = 'single quoted text' +regexp = /[a-z]+/ +symbol = :valid? diff --git a/tests/languages/ruby/snapshots/overrides.snap b/tests/languages/ruby/snapshots/overrides.snap new file mode 100644 index 0000000..9b8a2ca --- /dev/null +++ b/tests/languages/ruby/snapshots/overrides.snap @@ -0,0 +1,20 @@ +--- +source: tests/support/mod.rs +expression: captures +--- +- name: comment.inclusive + line: 1 + column: 1 + text: "# A Ruby comment" +- name: string.inclusive + line: 2 + column: 17 + text: plain text +- name: string.inclusive + line: 3 + column: 24 + text: "hello " +- name: string.inclusive + line: 4 + column: 25 + text: single quoted text diff --git a/tests/ruby.rs b/tests/ruby.rs index 07e4a0b..9922755 100644 --- a/tests/ruby.rs +++ b/tests/ruby.rs @@ -64,3 +64,16 @@ fn injections() { "languages/ruby/injections.scm", ); } + +// ============================================================================ +// Overrides Tests +// ============================================================================ + +#[test] +fn overrides() { + support::assert_query_snapshot( + "overrides", + "tests/languages/ruby/overrides.rb", + "languages/ruby/overrides.scm", + ); +}