Allow ALEFix functions to be defined with only the buffer argument

This commit is contained in:
w0rp
2017-06-06 23:13:53 +01:00
parent e4d886d4a7
commit f30652a98f
3 changed files with 42 additions and 5 deletions

View File

@@ -232,7 +232,10 @@ function! s:RunFixer(options) abort
let l:index = a:options.callback_index
while len(a:options.callback_list) > l:index
let l:result = call(a:options.callback_list[l:index], [l:buffer, copy(l:input)])
let l:Function = a:options.callback_list[l:index]
let l:result = ale#util#FunctionArgCount(l:Function) == 1
\ ? call(l:Function, [l:buffer])
\ : call(l:Function, [l:buffer, copy(l:input)])
if type(l:result) == type(0) && l:result == 0
" When `0` is returned, skip this item.