We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a023242 commit 6a40b53Copy full SHA for 6a40b53
lua/lualine/components/diagnostics/sources.lua
@@ -33,8 +33,19 @@ M.sources = {
33
workspace_diag(diag_severity.HINT)
34
end,
35
nvim_diagnostic = function()
36
+ local count
37
+
38
+ if vim.diagnostic.count ~= nil then -- neovim >= 0.10.0
39
+ count = vim.diagnostic.count(0)
40
+ return count[vim.diagnostic.severity.ERROR] or 0,
41
+ count[vim.diagnostic.severity.WARN] or 0,
42
+ count[vim.diagnostic.severity.INFO] or 0,
43
+ count[vim.diagnostic.severity.HINT] or 0
44
+ end
45
46
+ -- fallback
47
local diagnostics = vim.diagnostic.get(0)
- local count = { 0, 0, 0, 0 }
48
+ count = { 0, 0, 0, 0 }
49
for _, diagnostic in ipairs(diagnostics) do
50
count[diagnostic.severity] = count[diagnostic.severity] + 1
51
end
0 commit comments