mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-17 21:25:45 +08:00
26 lines
718 B
VimL
Vendored
26 lines
718 B
VimL
Vendored
" 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
|