Close #2556 - Support filename mapping

ALE now supports mapping files between different systems for running
linters and fixers with Docker, in virtual machines, in servers, etc.
This commit is contained in:
w0rp
2020-08-23 19:55:42 +01:00
parent 2b785688ea
commit ba3dd0d027
15 changed files with 483 additions and 74 deletions

View File

@@ -266,3 +266,23 @@ function! ale#GetLocItemMessage(item, format_string) abort
return l:msg
endfunction
" Given a buffer and a linter or fixer name, return an Array of two-item
" Arrays describing how to map filenames to and from the local to foreign file
" systems.
function! ale#GetFilenameMappings(buffer, name) abort
let l:linter_mappings = ale#Var(a:buffer, 'filename_mappings')
if type(l:linter_mappings) is v:t_list
return l:linter_mappings
endif
let l:name = a:name
if !has_key(l:linter_mappings, l:name)
" Use * as a default setting for all tools.
let l:name = '*'
endif
return get(l:linter_mappings, l:name, [])
endfunction