Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .nvim.lua
Original file line number Diff line number Diff line change
@@ -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
58 changes: 31 additions & 27 deletions lua/lsp-progress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down