summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/fixers/standard.vim2
-rw-r--r--test/fixers/test_standard_fixer_callback.vader14
2 files changed, 16 insertions, 0 deletions
diff --git a/autoload/ale/fixers/standard.vim b/autoload/ale/fixers/standard.vim
index 2b1f6f92..77712d40 100644
--- a/autoload/ale/fixers/standard.vim
+++ b/autoload/ale/fixers/standard.vim
@@ -14,9 +14,11 @@ endfunction
function! ale#fixers#standard#Fix(buffer) abort
let l:executable = ale#fixers#standard#GetExecutable(a:buffer)
+ let l:options = ale#Var(a:buffer, 'javascript_standard_options')
return {
\ 'command': ale#node#Executable(a:buffer, l:executable)
+ \ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --fix %t',
\ 'read_temporary_file': 1,
\}
diff --git a/test/fixers/test_standard_fixer_callback.vader b/test/fixers/test_standard_fixer_callback.vader
index 38f2d54a..db9f20f6 100644
--- a/test/fixers/test_standard_fixer_callback.vader
+++ b/test/fixers/test_standard_fixer_callback.vader
@@ -1,6 +1,9 @@
Before:
call ale#test#SetDirectory('/testplugin/test/fixers')
+ unlet! b:ale_javascript_standard_executable
+ unlet! b:ale_javascript_standard_options
+
After:
call ale#test#RestoreDirectory()
@@ -15,3 +18,14 @@ Execute(The executable path should be correct):
\ . ' --fix %t',
\ },
\ ale#fixers#standard#Fix(bufnr(''))
+
+Execute(Custom options should be supported):
+ let b:ale_javascript_standard_use_global = 1
+ let b:ale_javascript_standard_options = '--foo-bar'
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('standard') . ' --foo-bar --fix %t',
+ \ },
+ \ ale#fixers#standard#Fix(bufnr(''))