Refactor running of local Node programs with a helper function

This commit is contained in:
w0rp
2017-05-27 17:11:03 +01:00
parent b934dc52b6
commit c4f22186bd
12 changed files with 69 additions and 157 deletions

View File

@@ -1,21 +1,14 @@
" Author: KabbAmine <amine.kabb@gmail.com>, deathmaz <00maz1987@gmail.com>, diartyz <diartyz@gmail.com>
" Description: HTMLHint for checking html files
" CLI options
let g:ale_html_htmlhint_options = get(g:, 'ale_html_htmlhint_options', '--format=unix')
let g:ale_html_htmlhint_executable = get(g:, 'ale_html_htmlhint_executable', 'htmlhint')
let g:ale_html_htmlhint_use_global = get(g:, 'ale_html_htmlhint_use_global', 0)
call ale#Set('html_htmlhint_options', '--format=unix')
call ale#Set('html_htmlhint_executable', 'htmlhint')
call ale#Set('html_htmlhint_use_global', 0)
function! ale_linters#html#htmlhint#GetExecutable(buffer) abort
if ale#Var(a:buffer, 'html_htmlhint_use_global')
return ale#Var(a:buffer, 'html_htmlhint_executable')
endif
return ale#path#ResolveLocalPath(
\ a:buffer,
return ale#node#FindExecutable(a:buffer, 'html_htmlhint', [
\ 'node_modules/.bin/htmlhint',
\ ale#Var(a:buffer, 'html_htmlhint_executable')
\)
\])
endfunction
function! ale_linters#html#htmlhint#GetCommand(buffer) abort