mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
refactor(lsp): handling errors and nil responses together
This commit is contained in:
@@ -288,6 +288,7 @@ function STHighlighter:send_request()
|
|||||||
method = method .. '/delta'
|
method = method .. '/delta'
|
||||||
params.previousResultId = current_result.result_id
|
params.previousResultId = current_result.result_id
|
||||||
end
|
end
|
||||||
|
---@param response? lsp.SemanticTokens|lsp.SemanticTokensDelta
|
||||||
local success, request_id = client:request(method, params, function(err, response, ctx)
|
local success, request_id = client:request(method, params, function(err, response, ctx)
|
||||||
-- look client up again using ctx.client_id instead of using a captured
|
-- look client up again using ctx.client_id instead of using a captured
|
||||||
-- client object
|
-- client object
|
||||||
@@ -298,7 +299,7 @@ function STHighlighter:send_request()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if err then
|
if err or not response then
|
||||||
highlighter.client_state[c.id].active_request = {}
|
highlighter.client_state[c.id].active_request = {}
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -338,12 +339,6 @@ function STHighlighter:process_response(response, client, version)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- skip nil responses
|
|
||||||
if response == nil then
|
|
||||||
state.active_request = {}
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if not api.nvim_buf_is_valid(self.bufnr) then
|
if not api.nvim_buf_is_valid(self.bufnr) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user