summaryrefslogtreecommitdiff
path: root/autoload
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
parent0dbf08f6d5466262e66a6000d83be7270a9cef53 (diff)
downloadale-c546f47cc0c003053fb157b0ca2cced46b5429bc.zip
Merge everything into the one global map.
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/cleanup.vim4
-rw-r--r--autoload/ale/cursor.vim4
-rw-r--r--autoload/ale/engine.vim22
-rw-r--r--autoload/ale/statusline.vim2
4 files changed, 19 insertions, 13 deletions
diff --git a/autoload/ale/cleanup.vim b/autoload/ale/cleanup.vim
index 40a8a359..0a1cd391 100644
--- a/autoload/ale/cleanup.vim
+++ b/autoload/ale/cleanup.vim
@@ -2,10 +2,6 @@
" Description: Utility functions related to cleaning state.
function! ale#cleanup#Buffer(buffer) abort
- if has_key(g:ale_buffer_loclist_map, a:buffer)
- call remove(g:ale_buffer_loclist_map, a:buffer)
- endif
-
if has_key(g:ale_buffer_info, a:buffer)
" When buffers are removed, clear all of the jobs.
for l:job in get(g:ale_buffer_info[a:buffer], 'job_list', [])
diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim
index a20212c1..7f490339 100644
--- a/autoload/ale/cursor.vim
+++ b/autoload/ale/cursor.vim
@@ -46,12 +46,12 @@ function! ale#cursor#EchoCursorWarning(...) abort
let l:buffer = bufnr('%')
- if !has_key(g:ale_buffer_loclist_map, l:buffer)
+ if !has_key(g:ale_buffer_info, l:buffer)
return
endif
let l:pos = getcurpos()
- let l:loclist = g:ale_buffer_loclist_map[l:buffer]
+ let l:loclist = g:ale_buffer_info[l:buffer].loclist
let l:index = ale#util#BinarySearch(l:loclist, l:pos[1], l:pos[2])
if l:index >= 0
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.
diff --git a/autoload/ale/statusline.vim b/autoload/ale/statusline.vim
index 48b4d687..c01dd34d 100644
--- a/autoload/ale/statusline.vim
+++ b/autoload/ale/statusline.vim
@@ -27,7 +27,7 @@ function! s:SetupCount(buffer) abort
" Cache is cold, so manually ask for an update.
if !has_key(g:ale_buffer_info[a:buffer], 'count')
- call ale#statusline#Update(a:buffer, get(g:ale_buffer_loclist_map, a:buffer, []))
+ call ale#statusline#Update(a:buffer, g:ale_buffer_info[a:buffer].loclist)
endif
return 1