aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/handlers.lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-01-18 01:11:19 -0800
committerGitHub <noreply@github.com>2021-01-18 10:11:19 +0100
commit6d659bb338ee6cdb604b1d69404542e8d05aca55 (patch)
tree932ac726373431d7295cdd172a8382fa2639a13c /runtime/lua/vim/lsp/handlers.lua
parent41eea59dcfdb2d0f6ff9330f268d0e6fa5bf05c1 (diff)
downloadrneovim-6d659bb338ee6cdb604b1d69404542e8d05aca55.tar.gz
rneovim-6d659bb338ee6cdb604b1d69404542e8d05aca55.tar.bz2
rneovim-6d659bb338ee6cdb604b1d69404542e8d05aca55.zip
lsp: add client/registerCapability handler (#13780)
Until we support dynamicRegistration, we should handle the client/registerCapability in core. There are still some language servers that send this request despite dynamicRegistration not being registered client-side (we got an upstream fix for the node ones, but this depends on them bumping vscode-languageserver-node).
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r--runtime/lua/vim/lsp/handlers.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 87f35363b1..b4a1eff316 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -97,6 +97,18 @@ M['window/showMessageRequest'] = function(_, _, params)
end
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#client_registerCapability
+M['client/registerCapability'] = function(_, _, _, client_id)
+ local warning_tpl = "The language server %s triggers a registerCapability "..
+ "handler despite dynamicRegistration set to false. "..
+ "Report upstream, this warning is harmless"
+ local client = vim.lsp.get_client_by_id(client_id)
+ local client_name = client and client.name or string.format("id=%d", client_id)
+ local warning = string.format(warning_tpl, client_name)
+ log.warn(warning)
+ return vim.NIL
+end
+
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
M['textDocument/codeAction'] = function(_, _, actions)
if actions == nil or vim.tbl_isempty(actions) then