From e609a702eaf2d6bfb1e0fe8c44a5bf84436fb5a6 Mon Sep 17 00:00:00 2001 From: Jason Cheatham Date: Sat, 9 Oct 2021 13:41:01 -0400 Subject: fix(denols): update handlers to support 0.5.1 signature (#1233) --- lua/lspconfig/denols.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lua') diff --git a/lua/lspconfig/denols.lua b/lua/lspconfig/denols.lua index d8645c42..d16f3b3c 100644 --- a/lua/lspconfig/denols.lua +++ b/lua/lspconfig/denols.lua @@ -65,7 +65,7 @@ local function virtual_text_document(uri) virtual_text_document_handler(uri, result) end -local function denols_handler(err, method, result) +local function denols_handler(err, result, ctx) if not result or vim.tbl_isempty(result) then return nil end @@ -79,7 +79,13 @@ local function denols_handler(err, method, result) end end - lsp.handlers[method](err, method, result) + -- TODO remove this conditional when the handler is no longer being wrapped + -- with util.compat_handler (just use the else clause) + if vim.fn.has 'nvim-0.5.1' then + lsp.handlers[ctx.method](err, result, ctx) + else + lsp.handlers[ctx.method](err, ctx.method, result) + end end local function denols_definition() @@ -117,8 +123,8 @@ configs[server_name] = { unstable = false, }, handlers = { - ['textDocument/definition'] = denols_handler, - ['textDocument/references'] = denols_handler, + ['textDocument/definition'] = util.compat_handler(denols_handler), + ['textDocument/references'] = util.compat_handler(denols_handler), }, }, commands = { -- cgit v1.2.3-70-g09d2