mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-22 12:42:57 +08:00
Merge pull request #2472 from indelog/indelog_vim9lsp
Add extension for yegappan/lsp
This commit is contained in:
commit
841a355196
|
@ -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).
|
||||
|
|
27
autoload/airline/extensions/vim9lsp.vim
Normal file
27
autoload/airline/extensions/vim9lsp.vim
Normal 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
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user