vim-airline/autoload/airline/extensions/vim9lsp.vim
Indelog 8df0f3db4b Add extention for yegappan/lsp
Show errors and warnigs with yegappans/lsp plugin.
2021-11-26 10:12:11 +01:00

28 lines
978 B
VimL

" MIT License. Copyright (c) 2021 DEMAREST Maxime (maxime@indelog.fr)
" Plugin: https://github.com/yegappan/lsp
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !exists('*lsp#errorCount')
finish
endif
let s:error_symbol = get(g:, 'airline#extensions#vim9lsp#error_symbol', 'E:')
let s:warning_symbol = get(g:, 'airline#extensions#vim9lsp#warning_symbol', 'W:')
function! airline#extensions#vim9lsp#get_warnings() abort
let res = get(lsp#errorCount(), 'Warn', 0)
return res > 0 ? s:warning_symbol . res : ''
endfunction
function! airline#extensions#vim9lsp#get_errors() abort
let res = get(lsp#errorCount(), 'Error', 0)
return res > 0 ? s:error_symbol . res : ''
endfunction
function! airline#extensions#vim9lsp#init(ext) abort
call airline#parts#define_function('vim9lsp_warning_count', 'airline#extensions#vim9lsp#get_warnings')
call airline#parts#define_function('vim9lsp_error_count', 'airline#extensions#vim9lsp#get_errors')
endfunction