Skip to content

Make it possible to disable comment continuation #4152

Description

@Pasu4

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:

# 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgood-first-issueGood for newcomerspinnedThis issue or pull request is pinned and won't be marked as stale

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions