Fix #536 - Implement linter problem type re-mapping
This commit is contained in:
@@ -257,6 +257,28 @@ function! ale#engine#SetResults(buffer, loclist) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:RemapItemTypes(type_map, loclist) abort
|
||||
for l:item in a:loclist
|
||||
let l:key = l:item.type
|
||||
\ . (get(l:item, 'sub_type', '') ==# 'style' ? 'S' : '')
|
||||
let l:new_key = get(a:type_map, l:key, '')
|
||||
|
||||
if l:new_key ==# 'E'
|
||||
\|| l:new_key ==# 'ES'
|
||||
\|| l:new_key ==# 'W'
|
||||
\|| l:new_key ==# 'WS'
|
||||
\|| l:new_key ==# 'I'
|
||||
let l:item.type = l:new_key[0]
|
||||
|
||||
if l:new_key ==# 'ES' || l:new_key ==# 'WS'
|
||||
let l:item.sub_type = 'style'
|
||||
elseif has_key(l:item, 'sub_type')
|
||||
call remove(l:item, 'sub_type')
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! ale#engine#FixLocList(buffer, linter_name, loclist) abort
|
||||
let l:new_loclist = []
|
||||
|
||||
@@ -317,6 +339,12 @@ function! ale#engine#FixLocList(buffer, linter_name, loclist) abort
|
||||
call add(l:new_loclist, l:item)
|
||||
endfor
|
||||
|
||||
let l:type_map = get(ale#Var(a:buffer, 'type_map'), a:linter_name, {})
|
||||
|
||||
if !empty(l:type_map)
|
||||
call s:RemapItemTypes(l:type_map, l:new_loclist)
|
||||
endif
|
||||
|
||||
return l:new_loclist
|
||||
endfunction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user