summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorDaniel Lupu <lupu.daniel.f@gmail.com>2017-02-09 20:47:14 +0200
committerw0rp <w0rp@users.noreply.github.com>2017-02-09 18:47:14 +0000
commit6dfed8576e881c71f242c6d8d9a2502f0bb50f99 (patch)
tree0ee224fb962a694de39820d64a9b8b6a59febd00 /autoload
parent943fe9b4b0faa2d011694cea113b0ef44713a586 (diff)
downloadale-6dfed8576e881c71f242c6d8d9a2502f0bb50f99.zip
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
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/engine.vim22
-rw-r--r--autoload/ale/statusline.vim4
2 files changed, 17 insertions, 9 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index 55633ae0..34e5ad95 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -166,24 +166,28 @@ 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 = []
+ 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
+
+ " Mark line 200, column 17 with a squiggly line or something
+ " 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(g:ale_buffer_info[l:buffer].loclist)
+ call ale#list#SetLists(a:loclist)
endif
if g:ale_set_signs
- call ale#sign#SetSigns(l:buffer, g:ale_buffer_info[l:buffer].loclist)
+ 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(l:buffer, g:ale_buffer_info[l:buffer].loclist)
+ call ale#statusline#Update(a:buffer, a:loclist)
endif
-
- " Call user autocommands. This allows users to hook into ALE's lint cycle.
- silent doautocmd User ALELint
-
- " Mark line 200, column 17 with a squiggly line or something
- " matchadd('ALEError', '\%200l\%17v')
endfunction
function! s:HandleExitNeoVim(job, data, event) abort
diff --git a/autoload/ale/statusline.vim b/autoload/ale/statusline.vim
index c01dd34d..7269ddca 100644
--- a/autoload/ale/statusline.vim
+++ b/autoload/ale/statusline.vim
@@ -3,6 +3,10 @@
" Update the buffer error/warning count with data from loclist.
function! ale#statusline#Update(buffer, loclist) abort
+ if !has_key(g:ale_buffer_info, a:buffer)
+ return
+ endif
+
let l:errors = 0
let l:warnings = 0