1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:10:04 +08:00

fix(statusline): check vim.diagnostic.count

This commit is contained in:
Eric Wong 2024-05-25 20:39:18 +08:00
parent e9446e63fe
commit 9bd6508e8c
2 changed files with 8 additions and 1 deletions

View File

@ -257,7 +257,7 @@ endfunction
function! s:syntax_checking() abort
if SpaceVim#lsp#buf_server_ready()
let counts = v:lua.vim.diagnostic.count(0)
let counts = v:lua.require('spacevim.lsp').lsp_diagnostic_count()
let warnings = get(counts, 1, 0)
let errors = get(counts, 0, 0)
let l = warnings ? '%#SpaceVim_statusline_warn# ● ' . warnings . ' ' : ''

View File

@ -4,6 +4,13 @@ function M.server_ready()
return vim.b.lsp_server_ready
end
function M.lsp_diagnostic_count()
if vim.diagnostic.count then
return vim.diagnostic.count(0)
end
return {}
end
M.clients = {}
-- store the clients for different filetype
-- which can be called via vim.lsp.start_client()