Merge pull request #1810 from LarsMichelsen/visualize_checking

Visualize that ale is currently checking the current buffer
This commit is contained in:
Christian Brabandt 2018-10-22 08:59:52 +02:00 committed by GitHub
commit 08e9aa5386
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,10 +3,6 @@
scriptencoding utf-8 scriptencoding utf-8
let s:error_symbol = get(g:, 'airline#extensions#ale#error_symbol', 'E:')
let s:warning_symbol = get(g:, 'airline#extensions#ale#warning_symbol', 'W:')
let s:show_line_numbers = get(g:, 'airline#extensions#ale#show_line_numbers', 1)
function! s:airline_ale_count(cnt, symbol) function! s:airline_ale_count(cnt, symbol)
return a:cnt ? a:symbol. a:cnt : '' return a:cnt ? a:symbol. a:cnt : ''
endfunction endfunction
@ -37,13 +33,20 @@ function! airline#extensions#ale#get(type)
return '' return ''
endif endif
let is_err = a:type ==# 'error' let error_symbol = get(g:, 'airline#extensions#ale#error_symbol', 'E:')
let symbol = is_err ? s:error_symbol : s:warning_symbol let warning_symbol = get(g:, 'airline#extensions#ale#warning_symbol', 'W:')
let checking_symbol = get(g:, 'airline#extensions#ale#checking_symbol', '...')
let show_line_numbers = get(g:, 'airline#extensions#ale#show_line_numbers', 1)
let is_err = a:type ==# 'error' let is_err = a:type ==# 'error'
if ale#engine#IsCheckingBuffer(bufnr('')) == 1
return is_err ? '' : checking_symbol
endif
let symbol = is_err ? error_symbol : warning_symbol
let counts = ale#statusline#Count(bufnr('')) let counts = ale#statusline#Count(bufnr(''))
let symbol = is_err ? s:error_symbol : s:warning_symbol
if type(counts) == type({}) && has_key(counts, 'error') if type(counts) == type({}) && has_key(counts, 'error')
" Use the current Dictionary format. " Use the current Dictionary format.
let errors = counts.error + counts.style_error let errors = counts.error + counts.style_error
@ -53,7 +56,7 @@ function! airline#extensions#ale#get(type)
let num = is_err ? counts[0] : counts[1] let num = is_err ? counts[0] : counts[1]
endif endif
if s:show_line_numbers == 1 if show_line_numbers == 1
return s:airline_ale_count(num, symbol) . <sid>airline_ale_get_line_number(num, a:type) return s:airline_ale_count(num, symbol) . <sid>airline_ale_get_line_number(num, a:type)
else else
return s:airline_ale_count(num, symbol) return s:airline_ale_count(num, symbol)