diff options
author | w0rp <devw0rp@gmail.com> | 2020-08-23 19:55:42 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2020-08-23 19:55:42 +0100 |
commit | ba3dd0d02735e7b23918200ae58410b0deed2f62 (patch) | |
tree | 83012a41e42d746629fbf07293a1b3e7b7ed0fe6 /autoload/ale.vim | |
parent | 2b785688ead505dcbc1007374d3dca9914aa247a (diff) | |
download | ale-ba3dd0d02735e7b23918200ae58410b0deed2f62.zip |
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.
Diffstat (limited to 'autoload/ale.vim')
-rw-r--r-- | autoload/ale.vim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim index 6251b47b..b75c9fc9 100644 --- a/autoload/ale.vim +++ b/autoload/ale.vim @@ -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 |