Shopify / Shopify/ruby-lsp

Incorrect handling of multiple-byte characters in double-quote string literal Rubocop quickfix

Open
#4,094 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug pinned
Dominant language
Ruby
Stars
2k
Forks
281
Avg merge
2h 14m
Merged PRs (30d)
6

Description

Description

Performing a quickfix on a single-quoted string literal, when a rubocop rule preferring double-quotes is active, outputs a double-quoted string with utf-8 content garbled.

Ruby LSP Information

neovim:

NVIM v0.12.3-dev-53+g0aa77cb78c
Build type: RelWithDebInfo
LuaJIT 2.1.1774638290

ruby:

ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [x86_64-linux]

ruby-lsp: tested on 0.26.9 and 0.27.0.beta2

Reproduction steps
  • Setup rubocop in project with this rule
Style/StringLiterals:
  EnforcedStyle: single_quotes
  • Write a single quoted string containing multi-byte unicode characters
  • Perform quickfix
  • Unicode escape sequence is added and the last single-quote is not removed

https://github.com/user-attachments/assets/b163062d-b53c-413d-9e54-53acfe3d1b4b

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the quickfix with the stated Style/StringLiterals configuration and a single-quoted string containing multi-byte Unicode characters. Trace the Ruby LSP handling of the RuboCop quickfix; done means the converted string preserves its Unicode content and removes the original closing single quote.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.