From ba3dd0d02735e7b23918200ae58410b0deed2f62 Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 23 Aug 2020 19:55:42 +0100 Subject: 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. --- autoload/ale.vim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'autoload/ale.vim') 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 -- cgit v1.2.3