mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-20 12:34:42 +02:00
Add extention for yegappan/lsp
Show errors and warnigs with yegappans/lsp plugin.
This commit is contained in:
parent
4b96f58902
commit
8df0f3db4b
@ -471,6 +471,11 @@ function! airline#extensions#load()
|
|||||||
call add(s:loaded_ext, 'battery')
|
call add(s:loaded_ext, 'battery')
|
||||||
endif
|
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)
|
if !get(g:, 'airline#extensions#disable_rtp_load', 0)
|
||||||
" load all other extensions, which are not part of the default distribution.
|
" load all other extensions, which are not part of the default distribution.
|
||||||
" (autoload/airline/extensions/*.vim outside of our s:script_path).
|
" (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',
|
\ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count',
|
||||||
\ 'lsp_error_count', 'lsp_warning_count', 'scrollbar',
|
\ 'lsp_error_count', 'lsp_warning_count', 'scrollbar',
|
||||||
\ 'nvimlsp_error_count', 'nvimlsp_warning_count',
|
\ 'nvimlsp_error_count', 'nvimlsp_warning_count',
|
||||||
|
\ 'vim9lsp_warning_count', 'vim9lsp_error_count',
|
||||||
\ 'languageclient_error_count', 'languageclient_warning_count',
|
\ 'languageclient_error_count', 'languageclient_warning_count',
|
||||||
\ 'coc_warning_count', 'coc_error_count', 'vista', 'battery'])
|
\ 'coc_warning_count', 'coc_error_count', 'vista', 'battery'])
|
||||||
|
|
||||||
@ -242,9 +243,9 @@ function! airline#init#sections()
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if !exists('g:airline_section_error')
|
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
|
endif
|
||||||
if !exists('g:airline_section_warning')
|
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
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -1460,6 +1460,18 @@ Unite <https://github.com/Shougo/unite.vim>
|
|||||||
* enable/disable unite integration >
|
* enable/disable unite integration >
|
||||||
let g:airline#extensions#unite#enabled = 1
|
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*
|
------------------------------------- *airline-vimagit*
|
||||||
vimagit <https://github.com/jreybert/vimagit>
|
vimagit <https://github.com/jreybert/vimagit>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user