Skip to content

Commit

Permalink
refactor: fix empty error count output
Browse files Browse the repository at this point in the history
Signed-off-by: Avimitin <avimitin@gmail.com>
  • Loading branch information
Avimitin committed Dec 12, 2021
1 parent 201e0ca commit 457a91c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lua/galaxyline/provider_diagnostic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ end
-- nvim-lspconfig
-- see https://github.com/neovim/nvim-lspconfig
local function get_nvim_lsp_diagnostic(severity)
return vim.tbl_count(diag.get(0, { severity = severity }))
if next(lsp.buf_get_clients(0)) == nil then return '' end
local active_clients = lsp.get_active_clients()

if active_clients then
local count = vim.tbl_count(diag.get(0, { severity = severity }))

if count ~= 0 then return count .. ' ' end
end
end

function M.get_diagnostic_error()
Expand Down

0 comments on commit 457a91c

Please sign in to comment.