#653 - Update the loclist binary search to work with buffer numbers, to filter out items for other buffers

This commit is contained in:
w0rp
2017-08-12 14:27:47 +01:00
parent 7614560a6e
commit c52a4910bf
5 changed files with 83 additions and 41 deletions

View File

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