aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/_folding_range.lua
diff options
context:
space:
mode:
authorTristan Knight <admin@snappeh.com>2024-12-06 18:09:07 +0000
committerGitHub <noreply@github.com>2024-12-06 10:09:07 -0800
commitfac96b72a59e15d483e03bdc43b9ba08ce6c828e (patch)
tree4175c1dd7e0c834210daae1087b488e84cfec122 /runtime/lua/vim/lsp/_folding_range.lua
parent2550b5e9bdc0b4d19bc0313626ed0d3b928e491c (diff)
downloadrneovim-fac96b72a59e15d483e03bdc43b9ba08ce6c828e.tar.gz
rneovim-fac96b72a59e15d483e03bdc43b9ba08ce6c828e.tar.bz2
rneovim-fac96b72a59e15d483e03bdc43b9ba08ce6c828e.zip
fix(lsp): add foldingrange method support check #31463
Problem: The folding_range request method assumes that the client supports the method Solution: Add a capability guard to the call
Diffstat (limited to 'runtime/lua/vim/lsp/_folding_range.lua')
-rw-r--r--runtime/lua/vim/lsp/_folding_range.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/_folding_range.lua b/runtime/lua/vim/lsp/_folding_range.lua
index 6a445017a3..2f1767aaf5 100644
--- a/runtime/lua/vim/lsp/_folding_range.lua
+++ b/runtime/lua/vim/lsp/_folding_range.lua
@@ -271,7 +271,9 @@ local function setup(bufnr)
buffer = bufnr,
callback = function(args)
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
- request(bufnr, client)
+ if client:supports_method(vim.lsp.protocol.Methods.textDocument_foldingRange, bufnr) then
+ request(bufnr, client)
+ end
end,
})
api.nvim_create_autocmd('LspNotify', {