Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lsp): remove warnings from "Partial Result Progress" #148

Merged
merged 3 commits into from
Jul 15, 2024
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 @@
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 @@
-- )
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

Check warning on line 218 in lua/lsp-progress.lua

View check run for this annotation

Codecov / codecov/patch

lua/lsp-progress.lua#L218

Added line #L218 was not covered by tests
-- It's a work done progress
if cli:has_series(token) then
local ss = cli:get_series(token)
ss:finish(value.message)
cli:format()

Check warning on line 223 in lua/lsp-progress.lua

View check run for this annotation

Codecov / codecov/patch

lua/lsp-progress.lua#L220-L223

Added lines #L220 - L223 were not covered by tests
-- 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
Loading