Skip to content

fix(ruby): scope string overrides to literal content - #319

Merged
vitallium merged 2 commits into
mainfrom
vs/fix-interpolation-completion
Aug 29, 2026
Merged

fix(ruby): scope string overrides to literal content#319
vitallium merged 2 commits into
mainfrom
vs/fix-interpolation-completion

Conversation

@vitallium

Copy link
Copy Markdown
Collaborator

The Ruby extension currently captures each entire string with:

(string) @string

A Ruby string can contain executable Ruby code:

"The result is #{user.name}"

The broad capture also applies the string scope to user.name inside the interpolation. This can enable string-specific settings in normal Ruby code.
Changing the query to:

(string
  (string_content) @string.inclusive)

fixes the problem.

This limits the string scope to literal content:

string
->string_content       -> string scope
->interpolation          -> normal Ruby scope

This keeps string-specific settings, including Tailwind language-server opt-in and completion query characters, inside Ruby string content. Ruby code inside #{...} keeps normal Ruby behavior.

Closes #313

@cla-bot cla-bot Bot added the cla-signed label Aug 29, 2026
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 #313
@vitallium
vitallium force-pushed the vs/fix-interpolation-completion branch from 59a1b33 to ff9a706 Compare August 29, 2026 20:36
@vitallium
vitallium merged commit fa2b9d0 into main Aug 29, 2026
9 checks passed
@vitallium
vitallium deleted the vs/fix-interpolation-completion branch August 29, 2026 20:44
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.

No method completions after . inside Ruby string interpolations (#{obj.})

1 participant