Incorrect completion inside interpolated string when prefix contains Unicode characters
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
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.
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.
- Dominant language
- Ruby
- Stars
- 2k
- Forks
- 282
- Avg merge
- 12h 23m
- Merged PRs (30d)
- 9
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from Shopify/ruby-lsp
-
Multi-line `<%# %>` ERB comments are parsed as Ruby, so semantic highlighting colors the prose as method callsPossibly taken @Pybsama claimed this 66 days ago. Openbug Stale
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Shopify/ruby-lsp#4181 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Linux file system with square brackets in the directory/filename are failing to be indexedPossibly taken @andriytyurnikov claimed this 199 days ago. Openbug help-wanted pinned
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Shopify/ruby-lsp#3503 · 8 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
check-labels intermittently fails due to the organization IP allow listPossibly taken @soutaro claimed this 2 days ago. Open
Shopify/ruby-lsp#4219 · 1 assignee ·
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Maintainers usually reply within 1 day
-
bug pinned
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Shopify/ruby-lsp#4208 · 3 comments ·
Maintainers usually reply within 1 day
All issues in Shopify/ruby-lsp
Similar issues
-
PROJECT: ILR/DRS
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
thewca/worldcubeassociation.org#15914 ·
Maintainers usually reply within 1 day
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
benbalter/jekyll-include-cache#55 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
security
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
grafana/pyroscope#5729 · 1 comment ·
Maintainers usually reply within 1 day