aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/handlers.lua
diff options
context:
space:
mode:
authorruniq <patrice.peterson@mailbox.org>2022-04-20 18:40:52 +0200
committerGitHub <noreply@github.com>2022-04-20 18:40:52 +0200
commit7e7fdca163b10f8141c72936cea82051843c83c6 (patch)
treecab6e1491530c2bacbccff42b4df9118f7ae70c9 /runtime/lua/vim/lsp/handlers.lua
parent6b0d3ae6a83cb0410c16532a367ed8ad9bd093a8 (diff)
downloadrneovim-7e7fdca163b10f8141c72936cea82051843c83c6.tar.gz
rneovim-7e7fdca163b10f8141c72936cea82051843c83c6.tar.bz2
rneovim-7e7fdca163b10f8141c72936cea82051843c83c6.zip
fix(lsp): unify progress message handling (#18040)
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).
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r--runtime/lua/vim/lsp/handlers.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 9871f00677..71b4d33ec0 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -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")