Skip to content

Commit

Permalink
feat: add lsp command cancellation
Browse files Browse the repository at this point in the history
  • Loading branch information
Saghen committed Feb 4, 2025
1 parent 2de57ce commit 62d6ffe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/blink/cmp/sources/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ end
function lsp:execute(_, item, callback)
local client = vim.lsp.get_client_by_id(item.client_id)
if client and item.command then
client.request('workspace/executeCommand', item.command, function() callback() end)
local success, request_id = client.request('workspace/executeCommand', item.command, function() callback() end)
if success and request_id ~= nil then
return function() client.cancel_request(request_id) end
end
else
callback()
end
Expand Down

0 comments on commit 62d6ffe

Please sign in to comment.