mirror of
https://github.com/linrongbin16/lsp-progress.nvim.git
synced 2024-09-16 14:24:06 +02:00
fix(lsp): remove warnings from "Partial Result Progress" (#148)
Co-authored-by: linrongbin16 <linrongbin16@users.noreply.github.com>
This commit is contained in:
parent
c5858bba20
commit
5314be5a02
2 changed files with 34 additions and 30 deletions
|
@ -1,3 +1,3 @@
|
|||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
|
@ -184,11 +184,11 @@ local function update_progress(client, progress)
|
|||
cli:add_series(token, ss)
|
||||
-- start spin, it will also notify user at a fixed rate
|
||||
spin(client_id, token)
|
||||
-- logger.debug(
|
||||
-- "|progress_handler| add new series to client(%s): %s",
|
||||
-- vim.inspect(cli),
|
||||
-- vim.inspect(ss)
|
||||
-- )
|
||||
-- logger.debug(
|
||||
-- "|progress_handler| add new series to client(%s): %s",
|
||||
-- vim.inspect(cli),
|
||||
-- vim.inspect(ss)
|
||||
-- )
|
||||
elseif value.kind == "report" then
|
||||
local ss = cli:get_series(token)
|
||||
if ss then
|
||||
|
@ -207,28 +207,32 @@ local function update_progress(client, progress)
|
|||
-- )
|
||||
end
|
||||
else
|
||||
if value.kind ~= "end" then
|
||||
logger.warn(
|
||||
"|lsp-progress.progress_handler| Unknown message kind `%s` from client %s",
|
||||
value.kind,
|
||||
vim.inspect(cli)
|
||||
)
|
||||
end
|
||||
if cli:has_series(token) then
|
||||
local ss = cli:get_series(token)
|
||||
ss:finish(value.message)
|
||||
cli:format()
|
||||
-- logger.debug(
|
||||
-- "|progress_handler| series is done in client(%s): %s",
|
||||
-- vim.inspect(cli),
|
||||
-- vim.inspect(ss)
|
||||
-- )
|
||||
-- else
|
||||
-- logger.debug(
|
||||
-- "|lsp-progress.progress_handler| Series (token: %s) not found in client %s when ending",
|
||||
-- token,
|
||||
-- vim.inspect(cli)
|
||||
-- )
|
||||
-- The `$/progress` actually has several types:
|
||||
-- 1. Work Done Progress: The `value` payload has a `kind` field to tell user "begin", "report" and "end".
|
||||
-- 2. Partial Result Progress: The `value` has no such `kind` field, i.e. the `kind` is `nil`.
|
||||
--
|
||||
-- References:
|
||||
-- Progress Support: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#progress
|
||||
-- Work Done Progress: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workDoneProgress
|
||||
-- Partial Result Progress: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#partialResults
|
||||
if value.kind == "end" then
|
||||
-- It's a work done progress
|
||||
if cli:has_series(token) then
|
||||
local ss = cli:get_series(token)
|
||||
ss:finish(value.message)
|
||||
cli:format()
|
||||
-- logger.debug(
|
||||
-- "|progress_handler| series is done in client(%s): %s",
|
||||
-- vim.inspect(cli),
|
||||
-- vim.inspect(ss)
|
||||
-- )
|
||||
-- else
|
||||
-- logger.debug(
|
||||
-- "|lsp-progress.progress_handler| Series (token: %s) not found in client %s when ending",
|
||||
-- token,
|
||||
-- vim.inspect(cli)
|
||||
-- )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue