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')
|
||||
return ''
|
||||
endif
|
||||
let _backup = get(g:, 'coc_stl_format', '')
|
||||
|
||||
let is_err = (a:type is# 'error')
|
||||
let info = get(b:, 'coc_diagnostic_info', {})
|
||||
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)
|
||||
|
||||
if empty(cnt)
|
||||
return ''
|
||||
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
|
||||
endif
|
||||
endfunction
|
||||
|
|
|
@ -649,6 +649,12 @@ coc <https://github.com/neoclide/coc.nvim>
|
|||
<
|
||||
* enable/disable coc status display >
|
||||
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*
|
||||
command-t <https://github.com/wincent/command-t>
|
||||
|
|
Loading…
Reference in New Issue