Merge pull request #2472 from indelog/indelog_vim9lsp

Add extension for yegappan/lsp
This commit is contained in:
Christian Brabandt 2021-11-26 10:31:26 +01:00 committed by GitHub
commit 841a355196
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 2 deletions

View File

@ -472,6 +472,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

@ -1468,6 +1468,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>