#653 - Pass on filenames for loclist items
This commit is contained in:
@@ -333,6 +333,7 @@ function! s:RemapItemTypes(type_map, loclist) abort
|
||||
endfunction
|
||||
|
||||
function! ale#engine#FixLocList(buffer, linter_name, loclist) abort
|
||||
let l:bufnr_map = {}
|
||||
let l:new_loclist = []
|
||||
|
||||
" Some errors have line numbers beyond the end of the file,
|
||||
@@ -357,13 +358,36 @@ function! ale#engine#FixLocList(buffer, linter_name, loclist) abort
|
||||
\ 'text': l:old_item.text,
|
||||
\ 'lnum': str2nr(l:old_item.lnum),
|
||||
\ 'col': str2nr(get(l:old_item, 'col', 0)),
|
||||
\ 'bufnr': get(l:old_item, 'bufnr', a:buffer),
|
||||
\ 'vcol': get(l:old_item, 'vcol', 0),
|
||||
\ 'type': get(l:old_item, 'type', 'E'),
|
||||
\ 'nr': get(l:old_item, 'nr', -1),
|
||||
\ 'linter_name': a:linter_name,
|
||||
\}
|
||||
|
||||
if has_key(l:old_item, 'filename')
|
||||
" Use the filename given.
|
||||
let l:filename = l:old_item.filename
|
||||
let l:item.filename = l:filename
|
||||
|
||||
if has_key(l:old_item, 'bufnr')
|
||||
" If a buffer number is also given, include that too.
|
||||
" If Vim detects that he buffer number is valid, it will
|
||||
" be used instead of the filename.
|
||||
let l:item.bufnr = l:old_item.bufnr
|
||||
elseif has_key(l:bufnr_map, l:filename)
|
||||
" Get the buffer number from the map, which can be faster.
|
||||
let l:item.bufnr = l:bufnr_map[l:filename]
|
||||
else
|
||||
" Look up the buffer number.
|
||||
let l:item.bufnr = bufnr(l:filename)
|
||||
let l:bufnr_map[l:filename] = l:item.bufnr
|
||||
endif
|
||||
elseif has_key(l:old_item, 'bufnr')
|
||||
let l:item.bufnr = l:old_item.bufnr
|
||||
else
|
||||
let l:item.bufnr = a:buffer
|
||||
endif
|
||||
|
||||
if has_key(l:old_item, 'detail')
|
||||
let l:item.detail = l:old_item.detail
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user