fix deprecation warning

code is copied from https://github.com/vim-airline/vim-airline/issues/2289
originally contributed by @cmccannbrite
This commit is contained in:
timfeirg 2020-11-13 17:37:38 +08:00
parent 731bdb11d2
commit 5eae08609e
No known key found for this signature in database
GPG Key ID: E0AABAE6842603BA

View File

@ -25,7 +25,11 @@ function! airline#extensions#nvimlsp#get(type) abort
let symbol = is_err ? error_symbol : warning_symbol
let num = v:lua.vim.lsp.util.buf_diagnostics_count(a:type)
if luaeval("pcall(require, 'vim.lsp.diagnostic')")
let num = v:lua.vim.lsp.diagnostic.get_count(0, a:type)
else
let num = v:lua.vim.lsp.util.buf_diagnostics_count(a:type)
endif
return s:airline_nvimlsp_count(num, symbol)
endfunction