Incorrect completion inside interpolated string when prefix contains Unicode characters
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2k
- Forks
- 281
- Avg merge
- 2h 14m
- Merged PRs (30d)
- 6
Description
Description
Completion inside a Ruby interpolated string behaves incorrectly when the string prefix contains Unicode characters (e.g., emoji).
The completion inserts duplicated/garbled text instead of replacing the identifier prefix correctly.
Ruby LSP Information
VS Code Version
1.130.0
Ruby LSP Extension Version
0.10.4
Ruby LSP Server Version
0.26.9
Ruby LSP Add-ons
- Standard Ruby (unknown)
- Ruby LSP RSpec (0.26.9)
- Ruby LSP Rails (0.4.8)
- RuboCop (1.84.2)
Ruby Version
3.4.8
Ruby Version Manager
rbenv
Installed Extensions
Click to expand
- code-spell-checker (4.5.6)
- codesnap (1.3.4)
- opencode (0.0.13)
- ruby-lsp (0.10.4)
- vscode-pgsql (1.26.0)
- vscode-yaml (1.24.0)
Ruby LSP Settings
Click to expand
Workspace
{
"formatter": "standard"
}
User
{
"enabledFeatures": {
"codeActions": true,
"diagnostics": false,
"documentHighlights": true,
"documentLink": true,
"documentSymbols": true,
"foldingRanges": true,
"formatting": true,
"hover": true,
"inlayHint": true,
"onTypeFormatting": true,
"selectionRanges": true,
"semanticHighlighting": true,
"completion": true,
"codeLens": true,
"definition": true,
"workspaceSymbol": true,
"signatureHelp": true,
"typeHierarchy": true
},
"featuresConfiguration": {},
"addonSettings": {},
"rubyVersionManager": {
"identifier": "auto"
},
"customRubyCommand": "",
"formatter": "standard",
"linters": null,
"bundleGemfile": "",
"testTimeout": 30,
"pullDiagnosticsOn": "both",
"useBundlerCompose": false,
"bypassTypechecker": false,
"rubyExecutablePath": "",
"indexing": {},
"erbSupport": true,
"featureFlags": {},
"sigOpacityLevel": "1"
}
Reproduction steps
-
Start the Ruby LSP using Visual Studio Code
-
Create a Ruby file
-
Write a minimal example
test = "moo" "🐮 says #{te}" -
Trigger completion on
teand selecttest
Expected behavior
"🐮 says #{test}"
Actual behavior
"🐮 says #{tetest
Notice that the last
"is overwritten
Notes
It looks like the replacement range/offset for completion in interpolated string content is calculated incorrectly when Unicode characters appear earlier in the same string. The same issue also occurs outside of interpolated string declarations if the source code line is prefixed with Unicode characters.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the completion case in VS Code using the issue's Ruby example, then trace the completion replacement range and offset handling for Unicode-prefixed lines and interpolated strings. Done means selecting test produces "🐮 says #{test}" without overwriting the closing quote, including when Unicode appears outside interpolation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100