Move virtualtext handling to own file

This allows cursor and virtualtext to be independently autoloaded.
This commit is contained in:
Luan Santos
2018-11-06 22:31:35 -08:00
parent 25068de91d
commit f58a5cba05
6 changed files with 138 additions and 60 deletions

View File

@@ -452,3 +452,14 @@ function! ale#util#Col(str, chr) abort
return strlen(join(split(a:str, '\zs')[0:a:chr - 2], '')) + 1
endfunction
function! ale#util#FindItemAtCursor(buffer) abort
let l:info = get(g:ale_buffer_info, a:buffer, {})
let l:loclist = get(l:info, 'loclist', [])
let l:pos = getcurpos()
let l:index = ale#util#BinarySearch(l:loclist, a:buffer, l:pos[1], l:pos[2])
let l:loc = l:index >= 0 ? l:loclist[l:index] : {}
return [l:info, l:loc]
endfunction