add ALEToggle command (#303)

* add ALEToggle command

* stop active jobs when toggled off

* small logic cleanup & ensure ale can be ran manually while toggled off
This commit is contained in:
Daniel Lupu
2017-02-09 20:47:14 +02:00
committed by w0rp
parent 943fe9b4b0
commit 6dfed8576e
3 changed files with 77 additions and 36 deletions

View File

@@ -166,18 +166,7 @@ function! s:HandleExit(job) abort
let g:ale_buffer_info[l:buffer].loclist = g:ale_buffer_info[l:buffer].new_loclist
let g:ale_buffer_info[l:buffer].new_loclist = []
if g:ale_set_quickfix || g:ale_set_loclist
call ale#list#SetLists(g:ale_buffer_info[l:buffer].loclist)
endif
if g:ale_set_signs
call ale#sign#SetSigns(l:buffer, g:ale_buffer_info[l:buffer].loclist)
endif
if exists('*ale#statusline#Update')
" Don't load/run if not already loaded.
call ale#statusline#Update(l:buffer, g:ale_buffer_info[l:buffer].loclist)
endif
call ale#engine#SetResults(l:buffer, g:ale_buffer_info[l:buffer].loclist)
" Call user autocommands. This allows users to hook into ALE's lint cycle.
silent doautocmd User ALELint
@@ -186,6 +175,21 @@ function! s:HandleExit(job) abort
" matchadd('ALEError', '\%200l\%17v')
endfunction
function! ale#engine#SetResults(buffer, loclist) abort
if g:ale_set_quickfix || g:ale_set_loclist
call ale#list#SetLists(a:loclist)
endif
if g:ale_set_signs
call ale#sign#SetSigns(a:buffer, a:loclist)
endif
if exists('*ale#statusline#Update')
" Don't load/run if not already loaded.
call ale#statusline#Update(a:buffer, a:loclist)
endif
endfunction
function! s:HandleExitNeoVim(job, data, event) abort
call s:HandleExit(a:job)
endfunction