lsp: Fix "unsupported_method" error when the buffer does not have an LSP Server (#13175)

This commit is contained in:
eightpigs
2020-12-03 14:00:54 +08:00
committed by GitHub
parent 8fb786e415
commit fa73bb70fc
2 changed files with 44 additions and 6 deletions

View File

@@ -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