aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/util.lua
diff options
context:
space:
mode:
authorChristian Clason <christian.clason@uni-due.de>2021-09-10 10:10:18 +0200
committerGitHub <noreply@github.com>2021-09-10 01:10:18 -0700
commit38e489a12e991e0dd762de1adac976920fb438b5 (patch)
tree627e8d3901b08a5059b4f7422b205ff12fb7b097 /lua/lspconfig/util.lua
parent[docgen] Update CONFIG.md (diff)
downloadnvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.tar
nvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.tar.gz
nvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.tar.bz2
nvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.tar.lz
nvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.tar.xz
nvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.tar.zst
nvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.zip
fix: add compat shim for handler change in core (#1248)
Add a compatibility shim to `util.lua` adapting to change in handler signature and use it where needed. (Skip `rust-analyzer` and `denols` since their requests don't use handlers.)
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' },