Skip to content

Commit

Permalink
log: add warning about not having any active clients to poll
Browse files Browse the repository at this point in the history
  • Loading branch information
j-hui committed Feb 19, 2024
1 parent 4e854f3 commit 60404ba
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions lua/fidget/progress/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,15 @@ end)
---@return ProgressMessage[] progress_messages
---@see fidget.progress.lsp.ProgressMessage
function M.poll_for_messages()
local clients = vim.lsp.get_clients()
if #clients == 0 then
-- Issue being tracked in #177
logger.warn("No active LSP clients to poll from (see issue #177)")
return {}
end

local messages = {}
for _, client in ipairs(vim.lsp.get_clients()) do
for _, client in ipairs(clients) do
local client_name = string.format("%s (%s)", client.id, client.name)
local count = 0
logger.info("Polling messages from", client_name)
Expand Down Expand Up @@ -172,10 +179,16 @@ if not vim.lsp.status then
---@protected
---@return ProgressMessage[] progress_messages
function M.poll_for_messages()
local clients = vim.lsp.get_active_clients()
if #clients == 0 then
-- Issue being tracked in #177
logger.warn("No active LSP clients to poll from (see issue #177)")
return {}
end

local messages = {}
local to_remove = {}

for _, client in ipairs(vim.lsp.get_active_clients()) do
for _, client in ipairs(clients) do
local client_name = string.format("%s (%s)", client.id, client.name)
local count = 0
logger.info("Polling messages from", client_name)
Expand Down

0 comments on commit 60404ba

Please sign in to comment.