I have checked that this feature is not already implemented
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:
|
# If the previous line is a simple comment, we'll add a comment continuation |
|
# But if it's a RBS signature starting with `#:`, we'll ignore it |
|
# so users can immediately continue typing the method definition |
|
if (comment_match = @previous_line.match(/^#(?!:)(\s*)/)) |
|
handle_comment_line( |
|
comment_match[1], #: as !nil |
|
) |
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.
I have checked that this feature is not already implemented
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:
ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb
Lines 50 to 56 in 3f3121b
If possible, another user-configurable condition should be added to the
ifstatement in line 53 to allow users to disable it if they don't want to use it.