Skip to content

Commit

Permalink
fix(lsp): add placeholder cancel function (neovim#16189)
Browse files Browse the repository at this point in the history
Fixes a bug introduced by neovim#15949

When no supported clients for a given method are available, buf_request
returns early with a nil value. If buf_request_sync is called on a
buffer with no clients that support a given method, the returned
`cancel` method (which is nil), is invoked, resulting in an error.

Solution: return an empty function handle
  • Loading branch information
mjlbach committed Oct 31, 2021
1 parent 653d963 commit 4da0351
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/lua/vim/lsp.lua
Expand Up @@ -1317,7 +1317,7 @@ function lsp.buf_request(bufnr, method, params, handler)
if not tbl_isempty(all_buffer_active_clients[resolve_bufnr(bufnr)] or {}) and not method_supported then
vim.notify(lsp._unsupported_method(method), vim.log.levels.ERROR)
vim.api.nvim_command("redraw")
return
return {}, function() end
end

local client_request_ids = {}
Expand Down

0 comments on commit 4da0351

Please sign in to comment.