summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/fixers/mix_format.vim4
-rw-r--r--test/fixers/test_mix_format_fixer_callback.vader8
2 files changed, 9 insertions, 3 deletions
diff --git a/autoload/ale/fixers/mix_format.vim b/autoload/ale/fixers/mix_format.vim
index 3847d1b6..7a091701 100644
--- a/autoload/ale/fixers/mix_format.vim
+++ b/autoload/ale/fixers/mix_format.vim
@@ -12,7 +12,9 @@ function! ale#fixers#mix_format#GetCommand(buffer) abort
let l:executable = ale#Escape(ale#fixers#mix_format#GetExecutable(a:buffer))
let l:options = ale#Var(a:buffer, 'elixir_mix_format_options')
- return l:executable . ' format ' . l:options . ' %t'
+ return l:executable . ' format'
+ \ . (!empty(l:options) ? ' ' . l:options : '')
+ \ . ' %t'
endfunction
function! ale#fixers#mix_format#Fix(buffer) abort
diff --git a/test/fixers/test_mix_format_fixer_callback.vader b/test/fixers/test_mix_format_fixer_callback.vader
index 7bd7c77b..365fbecf 100644
--- a/test/fixers/test_mix_format_fixer_callback.vader
+++ b/test/fixers/test_mix_format_fixer_callback.vader
@@ -1,11 +1,15 @@
Before:
- call ale#test#SetDirectory('/testplugin/test/fixers')
Save g:ale_elixir_mix_executable
Save g:ale_elixir_mix_format_options
let g:ale_elixir_mix_executable = 'xxxinvalid'
+ let g:ale_elixir_mix_format_options = ''
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
After:
+ Restore
+
call ale#test#RestoreDirectory()
Execute(The mix_format callback should return the correct default values):
@@ -15,7 +19,7 @@ Execute(The mix_format callback should return the correct default values):
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape('xxxinvalid')
- \ . ' format %t',
+ \ . ' format %t',
\ },
\ ale#fixers#mix_format#Fix(bufnr(''))