@@ -21,7 +21,9 @@ local function get_nvim_lsp_diagnostic(diag_type)
2121 local count = 0
2222
2323 for _ , client in ipairs (active_clients ) do
24- count = count + lsp .diagnostic .get_count (api .nvim_get_current_buf (),diag_type ,client .id )
24+ local opts = { severity = diag_type }
25+ opts .namespace = vim .diagnostic .get_namespace (client .id )
26+ count = count + vim .diagnostic .get (api .nvim_get_current_buf (),opts )
2527 end
2628
2729 if count ~= 0 then return count .. ' ' end
@@ -32,7 +34,7 @@ function M.get_diagnostic_error()
3234 if vim .fn .exists (' *coc#rpc#start_server' ) == 1 then
3335 return get_coc_diagnostic (' error' )
3436 elseif not vim .tbl_isempty (lsp .buf_get_clients (0 )) then
35- return get_nvim_lsp_diagnostic (' Error ' )
37+ return get_nvim_lsp_diagnostic (vim . diagnostic . severity . ERROR )
3638 end
3739 return ' '
3840end
@@ -41,7 +43,7 @@ function M.get_diagnostic_warn()
4143 if vim .fn .exists (' *coc#rpc#start_server' ) == 1 then
4244 return get_coc_diagnostic (' warning' )
4345 elseif not vim .tbl_isempty (lsp .buf_get_clients (0 )) then
44- return get_nvim_lsp_diagnostic (' Warning ' )
46+ return get_nvim_lsp_diagnostic (vim . diagnostic . severity . WARN )
4547 end
4648 return ' '
4749end
@@ -50,7 +52,7 @@ function M.get_diagnostic_hint()
5052 if vim .fn .exists (' *coc#rpc#start_server' ) == 1 then
5153 return get_coc_diagnostic (' hint' )
5254 elseif not vim .tbl_isempty (lsp .buf_get_clients (0 )) then
53- return get_nvim_lsp_diagnostic (' Hint ' )
55+ return get_nvim_lsp_diagnostic (vim . diagnostic . severity . HINT )
5456 end
5557 return ' '
5658end
@@ -59,7 +61,7 @@ function M.get_diagnostic_info()
5961 if vim .fn .exists (' *coc#rpc#start_server' ) == 1 then
6062 return get_coc_diagnostic (' information' )
6163 elseif not vim .tbl_isempty (lsp .buf_get_clients (0 )) then
62- return get_nvim_lsp_diagnostic (' Information ' )
64+ return get_nvim_lsp_diagnostic (vim . diagnostic . severity . INFO )
6365 end
6466 return ' '
6567end
0 commit comments