feat(lsp): vim.lsp.buf.format() supports textDocument/rangesFormatting #27323

While this relies on a proposed LSP 3.18 feature, it's fully backwards
compatible, so IMO there's no harm in adding this already.

Looks like some servers already support for this e.g.
- gopls: https://go-review.googlesource.com/c/tools/+/510235
- clangd: https://github.com/llvm/llvm-project/pull/80180

Fixes #27293
This commit is contained in:
Tom Praschan
2024-06-24 16:54:56 +02:00
committed by GitHub
parent b0e5990907
commit 5581a95534
7 changed files with 158 additions and 11 deletions

View File

@@ -56,6 +56,7 @@ lsp._request_name_to_capability = {
[ms.workspace_symbol] = { 'workspaceSymbolProvider' },
[ms.textDocument_references] = { 'referencesProvider' },
[ms.textDocument_rangeFormatting] = { 'documentRangeFormattingProvider' },
[ms.textDocument_rangesFormatting] = { 'documentRangeFormattingProvider', 'rangesSupport' },
[ms.textDocument_formatting] = { 'documentFormattingProvider' },
[ms.textDocument_completion] = { 'completionProvider' },
[ms.textDocument_documentHighlight] = { 'documentHighlightProvider' },