diff options
author | francisco souza <fsouza@users.noreply.github.com> | 2020-10-25 08:17:34 -0400 |
---|---|---|
committer | francisco souza <fsouza@users.noreply.github.com> | 2020-10-25 08:17:34 -0400 |
commit | 1f0f92f8ec0ca94c47707cfebc9eeff561715368 (patch) | |
tree | 101417e0cde4cee41338979dd4a171c7e9363797 | |
parent | 6312792d8a6a7d293661d33d440343d4cc6e0e6e (diff) | |
download | rneovim-1f0f92f8ec0ca94c47707cfebc9eeff561715368.tar.gz rneovim-1f0f92f8ec0ca94c47707cfebc9eeff561715368.tar.bz2 rneovim-1f0f92f8ec0ca94c47707cfebc9eeff561715368.zip |
lsp: fix fallback for callback in method_unsupported
Missed this #12764. My bad :((
-rw-r--r-- | runtime/lua/vim/lsp.lua | 2 | ||||
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index fad213212a..1a0015e2db 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -1029,7 +1029,7 @@ function lsp.buf_request(bufnr, method, params, callback) -- error message. if not method_supported then local unsupported_err = lsp._unsupported_method(method) - local cb = callback or lsp.callbacks['method'] + local cb = callback or lsp.callbacks[method] if cb then cb(unsupported_err, method, bufnr) end diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 067a13ce68..73f3fe5d0c 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -323,6 +323,9 @@ describe('LSP', function() test_name = "capabilities_for_client_supports_method"; on_setup = function() exec_lua([=[ + vim.lsp.callbacks['textDocument/hover'] = function(err, method) + vim.lsp._last_lsp_callback = { err = err; method = method } + end vim.lsp._unsupported_method = function(method) vim.lsp._last_unsupported_method = method return 'fake-error' @@ -334,6 +337,9 @@ describe('LSP', function() client.stop() local method = exec_lua("return vim.lsp._last_unsupported_method") eq("textDocument/hover", method) + local lsp_cb_call = exec_lua("return vim.lsp._last_lsp_callback") + eq("fake-error", lsp_cb_call.err) + eq("textDocument/hover", lsp_cb_call.method) end; on_exit = function(code, signal) eq(0, code, "exit code", fake_lsp_logfile) |