]> git.madduck.net Git - etc/vim.git/blob - autoload/ale/fixers/importjs.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / autoload / ale / fixers / importjs.vim
1 " Author: Jeff Willette <jrwillette88@gmail.com>
2 " Description: Integration of importjs with ALE.
3
4 call ale#Set('javascript_importjs_executable', 'importjs')
5
6 function! ale#fixers#importjs#ProcessOutput(buffer, output) abort
7     let l:result = ale#util#FuzzyJSONDecode(a:output, [])
8
9     return split(get(l:result, 'fileContent', ''), "\n")
10 endfunction
11
12 function! ale#fixers#importjs#Fix(buffer) abort
13     let l:executable = ale#Var(a:buffer, 'javascript_importjs_executable')
14
15     if !executable(l:executable)
16         return 0
17     endif
18
19     return {
20     \   'command': ale#Escape(l:executable)
21     \       . ' fix'
22     \       . ' %s',
23     \   'process_with': 'ale#fixers#importjs#ProcessOutput',
24     \}
25 endfunction