Shopify / Shopify/ruby-lsp

Make it possible to disable comment continuation

Open
#4,152 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good-first-issue pinned
Dominant language
Ruby
Stars
2k
Forks
281
Avg merge
2h 14m
Merged PRs (30d)
6

Description

I have checked that this feature is not already implemented
  • This feature does not exist
Use case

When I write a single line comment, I usually want to write code directly after. However, ruby-lsp implements comment continuation for even single line comments, which causes me to attempt to write code on a comment line all the time before I notice and have to go back to remove the leading #. No other LSP that I use does comment continuation this way. The possibility to disable this would make it more convenient to write code for people using multiple languages.

Description

The option to disable comment continuation via the settings of the editor. I only work with VS Code, so I don't know if there would be complications for other editors.

Implementation

I'm (kind of) new to Ruby so I don't trust myself to talk implementation details, but I believe I have found where this feature is implemented at least:

https://github.com/Shopify/ruby-lsp/blob/3f3121bb908a847d712aba2a7ebc333eca186469/lib/ruby_lsp/requests/on_type_formatting.rb#L50-L56

If possible, another user-configurable condition should be added to the if statement in line 53 to allow users to disable it if they don't want to use it.

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 in lib/ruby_lsp/requests/on_type_formatting.rb at the referenced lines, then trace how editor settings are declared and passed to this request. Define a user-configurable option that controls comment continuation without assuming VS Code is the only client. Done means the setting disables continuation when selected while preserving current behavior by default, with coverage for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.