mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 10:20:05 +08:00
fix(statusline): check vim.diagnostic.count
This commit is contained in:
parent
e9446e63fe
commit
9bd6508e8c
@ -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 . ' ' : ''
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user