diff options
author | a-marquez <albert.marquez.2012@gmail.com> | 2018-05-02 18:26:13 -0400 |
---|---|---|
committer | a-marquez <albert.marquez.2012@gmail.com> | 2018-05-02 18:26:13 -0400 |
commit | 12d79894a4794d8a10a1177613bf5e78e56734aa (patch) | |
tree | 19d29eca95b2cb529561830b08b5d93162600467 /autoload | |
parent | e59cd6b7c0ba91c6dcfac5a6ce411e23af7a6252 (diff) | |
download | ale-12d79894a4794d8a10a1177613bf5e78e56734aa.zip |
Add fixer definition for XO
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fixers/xo.vim | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/autoload/ale/fixers/xo.vim b/autoload/ale/fixers/xo.vim new file mode 100644 index 00000000..882350be --- /dev/null +++ b/autoload/ale/fixers/xo.vim @@ -0,0 +1,23 @@ +" Author: Albert Marquez - https://github.com/a-marquez +" Description: Fixing files with XO. + +call ale#Set('javascript_xo_executable', 'xo') +call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('javascript_xo_options', '') + +function! ale#fixers#xo#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'javascript_xo', [ + \ 'node_modules/xo/cli.js', + \ 'node_modules/.bin/xo', + \]) +endfunction + +function! ale#fixers#xo#Fix(buffer) abort + let l:executable = ale#fixers#xo#GetExecutable(a:buffer) + + return { + \ 'command': ale#node#Executable(a:buffer, l:executable) + \ . ' --fix %t', + \ 'read_temporary_file': 1, + \} +endfunction |