mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
LSP: progress callback should only update existing dict for reports (#13652)
Change the update of the client.messages.progress table to overwrite only the percentage and message properties on $report, Previously we were overwriting the table which meant client.messages.progress[token].message.title was wiped on report.
This commit is contained in:
parent
5eccfd2b2e
commit
4a0a6f7bff
@ -28,8 +28,9 @@ end
|
|||||||
-- Basically a token of type number/string
|
-- Basically a token of type number/string
|
||||||
local function progress_callback(_, _, params, client_id)
|
local function progress_callback(_, _, params, client_id)
|
||||||
local client = vim.lsp.get_client_by_id(client_id)
|
local client = vim.lsp.get_client_by_id(client_id)
|
||||||
|
local client_name = client and client.name or string.format("id=%d", client_id)
|
||||||
if not client then
|
if not client then
|
||||||
err_message("LSP[", client_id, "] client has shut down after sending the message")
|
err_message("LSP[", client_name, "] client has shut down after sending the message")
|
||||||
end
|
end
|
||||||
local val = params.value -- unspecified yet
|
local val = params.value -- unspecified yet
|
||||||
local token = params.token -- string or number
|
local token = params.token -- string or number
|
||||||
@ -43,14 +44,11 @@ local function progress_callback(_, _, params, client_id)
|
|||||||
percentage = val.percentage,
|
percentage = val.percentage,
|
||||||
}
|
}
|
||||||
elseif val.kind == 'report' then
|
elseif val.kind == 'report' then
|
||||||
client.messages.progress[token] = {
|
client.messages.progress[token].message = val.message;
|
||||||
message = val.message,
|
client.messages.progress[token].percentage = val.percentage;
|
||||||
percentage = val.percentage,
|
|
||||||
}
|
|
||||||
elseif val.kind == 'end' then
|
elseif val.kind == 'end' then
|
||||||
if client.messages.progress[token] == nil then
|
if client.messages.progress[token] == nil then
|
||||||
err_message(
|
err_message("LSP[", client_name, "] received `end` message with no corresponding `begin`")
|
||||||
'echom "[lsp-status] Received `end` message with no corresponding `begin` from "')
|
|
||||||
else
|
else
|
||||||
client.messages.progress[token].message = val.message
|
client.messages.progress[token].message = val.message
|
||||||
client.messages.progress[token].done = true
|
client.messages.progress[token].done = true
|
||||||
@ -70,8 +68,9 @@ M['$/progress'] = progress_callback
|
|||||||
M['window/workDoneProgress/create'] = function(_, _, params, client_id)
|
M['window/workDoneProgress/create'] = function(_, _, params, client_id)
|
||||||
local client = vim.lsp.get_client_by_id(client_id)
|
local client = vim.lsp.get_client_by_id(client_id)
|
||||||
local token = params.token -- string or number
|
local token = params.token -- string or number
|
||||||
|
local client_name = client and client.name or string.format("id=%d", client_id)
|
||||||
if not client then
|
if not client then
|
||||||
err_message("LSP[", client_id, "] client has shut down after sending the message")
|
err_message("LSP[", client_name, "] client has shut down after sending the message")
|
||||||
end
|
end
|
||||||
client.messages.progress[token] = {}
|
client.messages.progress[token] = {}
|
||||||
return vim.NIL
|
return vim.NIL
|
||||||
|
Loading…
Reference in New Issue
Block a user