aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/util.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/lspconfig/util.lua')
-rw-r--r--lua/lspconfig/util.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua
index 50791462..6e0f7f41 100644
--- a/lua/lspconfig/util.lua
+++ b/lua/lspconfig/util.lua
@@ -19,6 +19,27 @@ M.default_config = {
-- global on_setup hook
M.on_setup = nil
+-- add compatibility shim for breaking signature change
+-- from https://github.com/mfussenegger/nvim-lsp-compl/
+-- TODO: remove after Neovim release
+function M.compat_handler(handler)
+ return function(...)
+ local config_or_client_id = select(4, ...)
+ local is_new = type(config_or_client_id) ~= 'number'
+ if is_new then
+ return handler(...)
+ else
+ local err = select(1, ...)
+ local method = select(2, ...)
+ local result = select(3, ...)
+ local client_id = select(4, ...)
+ local bufnr = select(5, ...)
+ local config = select(6, ...)
+ return handler(err, result, { method = method, client_id = client_id, bufnr = bufnr }, config)
+ end
+ end
+end
+
function M.validate_bufnr(bufnr)
validate {
bufnr = { bufnr, 'n' },