Fix #271 - Add the ability to open the quickfix or loclist windows only after saving a file

This commit is contained in:
w0rp
2017-08-08 00:46:42 +01:00
parent 2edea15358
commit 16cfedf04a
7 changed files with 84 additions and 13 deletions

View File

@@ -50,10 +50,11 @@ function! ale#cursor#TruncatedEcho(message) abort
endfunction
function! s:FindItemAtCursor() abort
let l:info = get(g:ale_buffer_info, bufnr('%'), {'loclist': []})
let l:info = get(g:ale_buffer_info, bufnr(''), {})
let l:loclist = get(l:info, 'loclist', [])
let l:pos = getcurpos()
let l:index = ale#util#BinarySearch(l:info.loclist, l:pos[1], l:pos[2])
let l:loc = l:index >= 0 ? l:info.loclist[l:index] : {}
let l:index = ale#util#BinarySearch(l:loclist, l:pos[1], l:pos[2])
let l:loc = l:index >= 0 ? l:loclist[l:index] : {}
return [l:info, l:loc]
endfunction