mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-15 08:47:06 +08:00
Add support for error details
Some review needed.
This commit is contained in:
@@ -93,3 +93,28 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort
|
||||
let s:cursor_timer = timer_start(10, function('ale#cursor#EchoCursorWarning'))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale#cursor#ShowCursorDetail(...) abort
|
||||
" Only show the details in normal mode, otherwise we will get problems.
|
||||
if mode() !=# 'n'
|
||||
return
|
||||
endif
|
||||
|
||||
let l:buffer = bufnr('%')
|
||||
|
||||
if !has_key(g:ale_buffer_info, l:buffer)
|
||||
return
|
||||
endif
|
||||
|
||||
let l:pos = getcurpos()
|
||||
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
|
||||
let l:loc = l:loclist[l:index]
|
||||
if has_key(l:loc, 'detail')
|
||||
echo l:loc.detail
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -332,6 +332,10 @@ function! ale#engine#FixLocList(buffer, linter, loclist) abort
|
||||
\ 'linter_name': a:linter.name,
|
||||
\}
|
||||
|
||||
if has_key(l:old_item, 'detail')
|
||||
let l:item.detail = l:old_item.detail
|
||||
endif
|
||||
|
||||
if l:item.lnum == 0
|
||||
" When errors appear at line 0, put them at line 1 instead.
|
||||
let l:item.lnum = 1
|
||||
|
||||
Reference in New Issue
Block a user