neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit a9b8a8dc6c1feaf5103699755086a393615602f2
parent ac12dc49cc35241acc6d4ea36f035ab5a5d9cfe3
Author: Andre Toerien <andre.toerien8@gmail.com>
Date:   Thu, 12 Jun 2025 18:21:53 +0200

fix(lsp): _cancel_all_requests() tries to cancel completed requests #34105

Problem:
The cancel function returned by `vim.lsp.buf_request` tries to cancel
all the requests, including those that have already been completed,
causing "Cannot find request with id ... whilst attempting to cancel"
errors to be logged when it is called.

Solution:
Only cancel the requests that are present in `client.requests`.
Diffstat:
Mruntime/lua/vim/lsp.lua | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua @@ -1306,7 +1306,9 @@ function lsp.buf_request(bufnr, method, params, handler, on_unsupported) local function _cancel_all_requests() for client_id, request_id in pairs(client_request_ids) do local client = all_clients[client_id] - client:cancel_request(request_id) + if client.requests[request_id] then + client:cancel_request(request_id) + end end end