summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-11 23:04:08 +0000
committerw0rp <devw0rp@gmail.com>2017-11-11 23:04:08 +0000
commitf6ac8a9eb9f2960747a2685be5e7d5ec4650b2d2 (patch)
tree533eeaf97d8a6f73c7e2a8ac918677ab33c441f7 /autoload
parentb789b9eaadb40f8560843b31c79f7e508a57f23c (diff)
downloadale-f6ac8a9eb9f2960747a2685be5e7d5ec4650b2d2.zip
#1108 Support selecting fixers with Lists
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix.vim27
1 files changed, 17 insertions, 10 deletions
diff --git a/autoload/ale/fix.vim b/autoload/ale/fix.vim
index a57ad195..5a42b74f 100644
--- a/autoload/ale/fix.vim
+++ b/autoload/ale/fix.vim
@@ -332,18 +332,25 @@ function! s:RunFixer(options) abort
endfunction
function! s:GetCallbacks() abort
- let l:fixers = ale#Var(bufnr(''), 'fixers')
- let l:callback_list = []
+ if type(get(b:, 'ale_fixers')) is type([])
+ " Lists can be used for buffer-local variables only
+ let l:callback_list = b:ale_fixers
+ else
+ " buffer and global options can use dictionaries mapping filetypes to
+ " callbacks to run.
+ let l:fixers = ale#Var(bufnr(''), 'fixers')
+ let l:callback_list = []
- for l:sub_type in split(&filetype, '\.')
- let l:sub_type_callacks = get(l:fixers, l:sub_type, [])
+ for l:sub_type in split(&filetype, '\.')
+ let l:sub_type_callacks = get(l:fixers, l:sub_type, [])
- if type(l:sub_type_callacks) == type('')
- call add(l:callback_list, l:sub_type_callacks)
- else
- call extend(l:callback_list, l:sub_type_callacks)
- endif
- endfor
+ if type(l:sub_type_callacks) == type('')
+ call add(l:callback_list, l:sub_type_callacks)
+ else
+ call extend(l:callback_list, l:sub_type_callacks)
+ endif
+ endfor
+ endif
if empty(l:callback_list)
return []