summaryrefslogtreecommitdiff
path: root/autoload/ale/engine.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2016-10-24 20:21:32 +0100
committerw0rp <devw0rp@gmail.com>2016-10-24 20:21:42 +0100
commitc546f47cc0c003053fb157b0ca2cced46b5429bc (patch)
tree0a17bd9520adb8630838b16a84f1433d93fdec84 /autoload/ale/engine.vim
parent0dbf08f6d5466262e66a6000d83be7270a9cef53 (diff)
downloadale-c546f47cc0c003053fb157b0ca2cced46b5429bc.zip
Merge everything into the one global map.
Diffstat (limited to 'autoload/ale/engine.vim')
-rw-r--r--autoload/ale/engine.vim22
1 files changed, 16 insertions, 6 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index 5a257505..9af1f536 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -26,6 +26,7 @@ function! ale#engine#InitBufferInfo(buffer) abort
\ 'job_list': [],
\ 'should_reset': 1,
\ 'dummy_sign_set': 0,
+ \ 'loclist': [],
\}
endif
endfunction
@@ -121,28 +122,28 @@ function! s:HandleExit(job) abort
" Set the flag for resetting the loclist to 0 again, so we won't
" empty the list later.
let g:ale_buffer_info[l:buffer].should_reset = 0
- let g:ale_buffer_loclist_map[l:buffer] = []
+ let g:ale_buffer_info[l:buffer].loclist = []
endif
" Add the loclist items from the linter.
- call extend(g:ale_buffer_loclist_map[l:buffer], l:linter_loclist)
+ call extend(g:ale_buffer_info[l:buffer].loclist, l:linter_loclist)
" Sort the loclist again.
" We need a sorted list so we can run a binary search against it
" for efficient lookup of the messages in the cursor handler.
- call sort(g:ale_buffer_loclist_map[l:buffer], 'ale#util#LocItemCompare')
+ call sort(g:ale_buffer_info[l:buffer].loclist, 'ale#util#LocItemCompare')
if g:ale_set_loclist
- call setloclist(0, g:ale_buffer_loclist_map[l:buffer])
+ call setloclist(0, g:ale_buffer_info[l:buffer].loclist)
endif
if g:ale_set_signs
- call ale#sign#SetSigns(l:buffer, g:ale_buffer_loclist_map[l:buffer])
+ 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_loclist_map[l:buffer])
+ call ale#statusline#Update(l:buffer, g:ale_buffer_info[l:buffer].loclist)
endif
" Call user autocommands. This allows users to hook into ALE's lint cycle.
@@ -281,6 +282,15 @@ function! ale#engine#Invoke(buffer, linter) abort
endif
endfunction
+" Given a buffer number, return the warnings and errors for a given buffer.
+function! ale#engine#GetLoclist(buffer) abort
+ if !has_key(g:ale_buffer_info, a:buffer)
+ return []
+ endif
+
+ return g:ale_buffer_info[a:buffer].loclist
+endfunction
+
" This function can be called with a timeout to wait for all jobs to finish.
" If the jobs to not finish in the given number of milliseconds,
" an exception will be thrown.