Add extention for yegappan/lsp

Show errors and warnigs with yegappans/lsp plugin.
This commit is contained in:
Indelog 2021-11-10 17:56:07 +01:00
parent 4b96f58902
commit 8df0f3db4b
4 changed files with 47 additions and 2 deletions

View File

@ -471,6 +471,11 @@ function! airline#extensions#load()
call add(s:loaded_ext, 'battery')
endif
if (get(g:, 'airline#extensions#vim9lsp#enabled', 1) && exists('*lsp#errorCount'))
call airline#extensions#vim9lsp#init(s:ext)
call add(s:loaded_ext, 'vim9lsp')
endif
if !get(g:, 'airline#extensions#disable_rtp_load', 0)
" load all other extensions, which are not part of the default distribution.
" (autoload/airline/extensions/*.vim outside of our s:script_path).

View File

@ -0,0 +1,27 @@
" 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

View File

@ -191,6 +191,7 @@ function! airline#init#bootstrap()
\ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count',
\ 'lsp_error_count', 'lsp_warning_count', 'scrollbar',
\ 'nvimlsp_error_count', 'nvimlsp_warning_count',
\ 'vim9lsp_warning_count', 'vim9lsp_error_count',
\ 'languageclient_error_count', 'languageclient_warning_count',
\ 'coc_warning_count', 'coc_error_count', 'vista', 'battery'])
@ -242,9 +243,9 @@ function! airline#init#sections()
endif
endif
if !exists('g:airline_section_error')
let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic-err', 'eclim', 'neomake_error_count', 'ale_error_count', 'lsp_error_count', 'nvimlsp_error_count', 'languageclient_error_count', 'coc_error_count'])
let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic-err', 'eclim', 'neomake_error_count', 'ale_error_count', 'lsp_error_count', 'nvimlsp_error_count', 'languageclient_error_count', 'coc_error_count', 'vim9lsp_error_count'])
endif
if !exists('g:airline_section_warning')
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'syntastic-warn', 'neomake_warning_count', 'ale_warning_count', 'lsp_warning_count', 'nvimlsp_warning_count', 'languageclient_warning_count', 'whitespace', 'coc_warning_count'])
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'syntastic-warn', 'neomake_warning_count', 'ale_warning_count', 'lsp_warning_count', 'nvimlsp_warning_count', 'languageclient_warning_count', 'whitespace', 'coc_warning_count', 'vim9lsp_warning_count'])
endif
endfunction

View File

@ -1460,6 +1460,18 @@ Unite <https://github.com/Shougo/unite.vim>
* enable/disable unite integration >
let g:airline#extensions#unite#enabled = 1
------------------------------------- *airline-vim9lsp*
vim9lsp <https://github.com/yegappan/lsp>
* enable/disable vim9lsp integration >
let airline#extensions#vim9lsp#enabled = 1
<
* vim9lsp error_symbol >
let airline#extensions#vim9lsp#error_symbol = 'E:'
<
* vim9lsp warning >
let airline#extensions#vim9lsp#warning_symbol = 'W:'
<
------------------------------------- *airline-vimagit*
vimagit <https://github.com/jreybert/vimagit>