From fa73bb70fc8dfbdd4527ecfb33e282c1eef31dd1 Mon Sep 17 00:00:00 2001 From: eightpigs Date: Thu, 3 Dec 2020 14:00:54 +0800 Subject: lsp: Fix "unsupported_method" error when the buffer does not have an LSP Server (#13175) --- runtime/lua/vim/lsp.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 92f56b2ddf..f082fe29f2 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -1032,9 +1032,9 @@ function lsp.buf_request(bufnr, method, params, handler) end end) - -- if no clients support the given method, call the handler with the proper + -- if has client but no clients support the given method, call the callback with the proper -- error message. - if not method_supported then + if not tbl_isempty(all_buffer_active_clients[resolve_bufnr(bufnr)] or {}) and not method_supported then local unsupported_err = lsp._unsupported_method(method) handler = handler or lsp.handlers[method] if handler then -- cgit