summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-06-07 09:26:54 +0100
committerw0rp <devw0rp@gmail.com>2017-06-07 09:26:54 +0100
commit11e38efa83bc1376d88f810a8d94b4fd5b6f2b6e (patch)
treec170f98af75a47b83e514677fa0dba3e4acfbde1
parentf30652a98f6c350ca02dde8d43c9eaafb1ac9f18 (diff)
downloadale-11e38efa83bc1376d88f810a8d94b4fd5b6f2b6e.zip
Fix a bug which breaks the tests
-rw-r--r--autoload/ale/fix.vim7
-rw-r--r--autoload/ale/util.vim6
2 files changed, 9 insertions, 4 deletions
diff --git a/autoload/ale/fix.vim b/autoload/ale/fix.vim
index 7513a7cc..e7cac271 100644
--- a/autoload/ale/fix.vim
+++ b/autoload/ale/fix.vim
@@ -232,10 +232,11 @@ function! s:RunFixer(options) abort
let l:index = a:options.callback_index
while len(a:options.callback_list) > l:index
- let l:Function = a:options.callback_list[l:index]
+ let l:Function = ale#util#GetFunction(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)])
+ \ ? l:Function(l:buffer)
+ \ : l:Function(l:buffer, copy(l:input))
if type(l:result) == type(0) && l:result == 0
" When `0` is returned, skip this item.
diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim
index 90e052a7..50f5adcf 100644
--- a/autoload/ale/util.vim
+++ b/autoload/ale/util.vim
@@ -130,9 +130,13 @@ function! ale#util#FunctionArgCount(function) abort
let l:Function = ale#util#GetFunction(a:function)
redir => l:output
- silent function Function
+ silent! function Function
redir END
+ if !exists('l:output')
+ return 0
+ endif
+
let l:match = matchstr(split(l:output, "\n")[0], '\v\([^)]+\)')[1:-2]
let l:arg_list = filter(split(l:match, ', '), 'v:val !=# ''...''')