Close #2152 - Use ale_javascript_standard_options for fixing files too
This commit is contained in:
parent
13060a3492
commit
9a3be907ea
@ -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,
|
||||
\}
|
||||
|
@ -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(''))
|
||||
|
Loading…
Reference in New Issue
Block a user