mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-26 02:09:48 +08:00
Use the coc status variable to format error/warning line number
This commit is contained in:
parent
0ed7b8bb2e
commit
d56f199405
|
@ -20,18 +20,23 @@ function! airline#extensions#coc#get(type) abort
|
||||||
if !exists(':CocCommand')
|
if !exists(':CocCommand')
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
let _backup = get(g:, 'coc_stl_format', '')
|
|
||||||
let is_err = (a:type is# 'error')
|
let is_err = (a:type is# 'error')
|
||||||
let info = get(b:, 'coc_diagnostic_info', {})
|
let info = get(b:, 'coc_diagnostic_info', {})
|
||||||
if empty(info) | return '' | endif
|
if empty(info) | return '' | endif
|
||||||
|
|
||||||
|
if is_err
|
||||||
|
let format = get(g:, 'airline#extensions#coc#stl_format_err', '(L%d)')
|
||||||
|
else
|
||||||
|
let format = get(g:, 'airline#extensions#coc#stl_format_warn', '(L%d)')
|
||||||
|
endif
|
||||||
|
|
||||||
let cnt = get(info, a:type, 0)
|
let cnt = get(info, a:type, 0)
|
||||||
|
|
||||||
if empty(cnt)
|
if empty(cnt)
|
||||||
return ''
|
return ''
|
||||||
else
|
else
|
||||||
let lnum = printf('(L%d)', (info.lnums)[is_err ? 0 : 1])
|
let lnum = printf(format, (info.lnums)[is_err ? 0 : 1])
|
||||||
return (is_err ? s:error_symbol : s:warning_symbol).cnt.lnum
|
return (is_err ? s:error_symbol : s:warning_symbol).cnt.lnum
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
|
@ -649,6 +649,12 @@ coc <https://github.com/neoclide/coc.nvim>
|
||||||
<
|
<
|
||||||
* enable/disable coc status display >
|
* enable/disable coc status display >
|
||||||
g:airline#extensions#coc#show_coc_status = 1
|
g:airline#extensions#coc#show_coc_status = 1
|
||||||
|
|
||||||
|
* change the error format: >
|
||||||
|
let airline#extensions#coc#stl_format_err = '(L%d)'
|
||||||
|
<
|
||||||
|
* change the warning format: >
|
||||||
|
let airline#extensions#coc#stl_format_warn = '(L%d)'
|
||||||
<
|
<
|
||||||
------------------------------------- *airline-commandt*
|
------------------------------------- *airline-commandt*
|
||||||
command-t <https://github.com/wincent/command-t>
|
command-t <https://github.com/wincent/command-t>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user