Add range formatting to the ruby-lsp
#203
Labels
enhancement
New feature or request
pinned
This issue or pull request is pinned and won't be marked as stale
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
The text was updated successfully, but these errors were encountered: