Skip to content

Commit

Permalink
fix: handle failed lsp resolve request gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
Saghen committed Oct 28, 2024
1 parent 0271d79 commit 4c40bf2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/blink/cmp/sources/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ function lsp:resolve(item, callback)
-- strip blink specific fields to avoid decoding errors on some LSPs
item = require('blink.cmp.sources.lib.utils').blink_item_to_lsp_item(item)

local _, request_id = client.request('completionItem/resolve', item, function(error, resolved_item)
local success, request_id = client.request('completionItem/resolve', item, function(error, resolved_item)
if error or resolved_item == nil then callback(item) end
callback(resolved_item)
end)
if not success then callback(item) end
if request_id ~= nil then return function() client.cancel_request(request_id) end end
end

Expand Down

0 comments on commit 4c40bf2

Please sign in to comment.