ale ext: simplify logic
This commit is contained in:
parent
1891933e59
commit
7f3d6287b5
|
@ -20,17 +20,17 @@ function! s:count(index)
|
||||||
return l:count
|
return l:count
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#ale#get_errors()
|
function! airline#extensions#ale#get(type)
|
||||||
let l:count = s:count(0)
|
let is_err = a:type is# 'error'
|
||||||
return l:count ? s:error_symbol . l:count : ''
|
let cnt = s:count(is_err)
|
||||||
endfunction
|
if cnt == 0
|
||||||
|
return ''
|
||||||
function! airline#extensions#ale#get_warnings()
|
else
|
||||||
let l:count = s:count(1)
|
return (is_err ? s:error_symbol : s:warning_symbol) . cnt
|
||||||
return l:count ? s:warning_symbol . l:count : ''
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#ale#init(ext)
|
function! airline#extensions#ale#init(ext)
|
||||||
call airline#parts#define_function('ale_error_count', 'airline#extensions#ale#get_errors')
|
call airline#parts#define_function('ale_error_count', 'airline#extensions#ale#get("error")')
|
||||||
call airline#parts#define_function('ale_warning_count', 'airline#extensions#ale#get_warnings')
|
call airline#parts#define_function('ale_warning_count', 'airline#extensions#ale#get("warning")')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
Loading…
Reference in New Issue