fix(lsp): unify progress message handling (#18468)

The LSP progress handler would put non-progress messages (such as from
clangd or pyls; not part of the LSP spec) directly into
`client.messages`, while `vim.lsp.util.get_progress_messages()` would
try to fetch them from `client.messages.messages` instead (and come up
empty everytime). This would result in these messages never being
cleaned up by `get_progress_messages()`.

This commit fixes that by treating those messages like show-once
progress messages (by setting `done=true` immediately).

(cherry picked from commit 2087960c76)

Co-authored-by: Patrice Peterson <patrice.peterson@mailbox.org>
This commit is contained in:
github-actions[bot]
2022-05-08 11:27:22 +02:00
committed by GitHub
parent 28c08fdbe3
commit 9e040acfa3
2 changed files with 3 additions and 26 deletions

View File

@@ -33,7 +33,7 @@ local function progress_handler(_, result, ctx, _)
local val = result.value -- unspecified yet
local token = result.token -- string or number
if type(val) ~= 'table' then val = { content=val } end
if val.kind then
if val.kind == 'begin' then
client.messages.progress[token] = {
@@ -53,7 +53,8 @@ local function progress_handler(_, result, ctx, _)
end
end
else
table.insert(client.messages, {content = val, show_once = true, shown = 0})
client.messages.progress[token] = val
client.messages.progress[token].done = true
end
vim.api.nvim_command("doautocmd <nomodeline> User LspProgressUpdate")