Shopify / Shopify/ruby-lsp

Poor comment continuation character placement

Open
#3,749 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description
Ruby LSP Information

I'm running ruby-lsp 0.26.1 on GNU Emacs. I've reproduced this problem using GNU Emacs 29.3 packaged by Debian running on Ubuntu 24.04, as well as on GNU Emacs 30.2 packed via emacs-plus running on macOS Sequoia 15.6.

I have ruby-lsp installed via running gem install ruby-lsp.

I am running lsp via the following configuration:

(use-package lsp-mode
  :config
  (mapcar (lambda (x) (add-to-list 'lsp-disabled-clients x)) '(steep-ls solargraph rubocop-ls ruby-ls))
  :hook (ruby-ts-mode . lsp))
Reproduction steps
  1. Open a new ruby buffer. (With the config listed above, this automatically starts lsp and ruby-lsp.)
  2. Type #. Now the buffer looks like: #<cursor>
  3. Type RET

Now the buffer looks like:

#
<cursor>#

which I think is probably always wrong. Sometimes I may want to continue a block comment, in which case this behavior is perhaps ok except the placement of the cursor and line 2 octothorpe should be switched. Much more commonly however, I don't want to continue the block comment, I want to just start writing ruby; the current behavior means I need to press Delete in order to do that, which is annoying.

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

Reproduce the behavior in a Ruby buffer using GNU Emacs and the provided lsp-mode configuration, starting from the ruby-lsp comment continuation entry point. Compare pressing RET after # with the expected cursor and octothorpe placement, and confirm that ordinary Ruby writing does not require pressing Delete.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.