From c618b314c6a266806edf692122b16ba9ff7a8e10 Mon Sep 17 00:00:00 2001 From: Michael Lingelbach Date: Sat, 30 Apr 2022 02:22:30 -0700 Subject: chore(lsp): remove capabilities sanitization (#17814) * feat(lsp)!: remove capabilities sanitization Users must now access client.server_capabilities which matches the same structure as the protocol. https://microsoft.github.io/language-server-protocol/specification client.resolved_capabilities is no longer used to gate capabilities, and will be removed in a future release. BREAKING CHANGE Co-authored-by: Mathias Fussenegger --- runtime/lua/vim/lsp/buf.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'runtime/lua/vim/lsp/buf.lua') diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 00919c6b04..62de8d7321 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -224,7 +224,7 @@ function M.formatting_seq_sync(options, timeout_ms, order) -- loop through the clients and make synchronous formatting requests for _, client in pairs(clients) do - if client.resolved_capabilities.document_formatting then + if vim.tbl_get(client.server_capabilities, "documentFormattingProvider") then local params = util.make_formatting_params(options) local result, err = client.request_sync("textDocument/formatting", params, timeout_ms, vim.api.nvim_get_current_buf()) if result and result.result then @@ -545,8 +545,7 @@ local function on_code_action_results(results, ctx, options) local action = action_tuple[2] if not action.edit and client - and type(client.resolved_capabilities.code_action) == 'table' - and client.resolved_capabilities.code_action.resolveProvider then + and vim.tbl_get(client.server_capabilities, "codeActionProvider", "resolveProvider") then client.request('codeAction/resolve', action, function(err, resolved_action) if err then -- cgit