mirror of
1
0
Fork 0
ultimate-vim/sources_non_forked/ale/autoload/ale/fixers/importjs.vim

26 lines
718 B
VimL

" Author: Jeff Willette <jrwillette88@gmail.com>
" Description: Integration of importjs with ALE.
call ale#Set('javascript_importjs_executable', 'importjs')
function! ale#fixers#importjs#ProcessOutput(buffer, output) abort
let l:result = ale#util#FuzzyJSONDecode(a:output, [])
return split(get(l:result, 'fileContent', ''), "\n")
endfunction
function! ale#fixers#importjs#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'javascript_importjs_executable')
if !executable(l:executable)
return 0
endif
return {
\ 'command': ale#Escape(l:executable)
\ . ' fix'
\ . ' %s',
\ 'process_with': 'ale#fixers#importjs#ProcessOutput',
\}
endfunction