Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add range formatting to the ruby-lsp #203

Open
vinistock opened this issue Jul 15, 2022 · 1 comment
Open

Add range formatting to the ruby-lsp #203

vinistock opened this issue Jul 15, 2022 · 1 comment
Labels
enhancement New feature or request pinned This issue or pull request is pinned and won't be marked as stale

Comments

@vinistock
Copy link
Member

Range formatting is a request very similar to formatting, but it applies only to the selected range and not the entire document.

Currently, trying to format ranges with either RuboCop or SyntaxTree fails, because both believe they are always looking at whole files instead of ranges.

For RuboCop, this will be difficult to overcome, given that trying to format a range in the middle of the document will even add # frozen_string_literal comments.

However, we may be able to use SyntaxTree for this if we add the ability of informing the formatter about the current indentation (or nesting) level. In the current behaviour, the code inside the range will be considered as a whole file and everything is pushed to indentation level zero.

Documentation: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_rangeFormatting

@vinistock vinistock mentioned this issue Jul 15, 2022
@vinistock vinistock added enhancement New feature or request pinned This issue or pull request is pinned and won't be marked as stale labels Jul 20, 2023
andyw8 pushed a commit to andyw8/ruby-lsp that referenced this issue Mar 2, 2024
…sce-2.11.0

Bump vsce from 2.10.2 to 2.11.0
@bsgreenb
Copy link

This would be big! Can't use formatOnSaveMode until this is introduced!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pinned This issue or pull request is pinned and won't be marked as stale
Projects
None yet
Development

No branches or pull requests

2 participants