Merge pull request #1313 from rhysd/fixjson-local-install

fixjson: Add support for local installation
This commit is contained in:
w0rp 2018-01-25 10:29:51 +00:00 committed by GitHub
commit dffc162dd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -3,9 +3,16 @@
call ale#Set('json_fixjson_executable', 'fixjson')
call ale#Set('json_fixjson_options', '')
call ale#Set('json_fixjson_use_global', 0)
function! ale#fixers#fixjson#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'json_fixjson', [
\ 'node_modules/.bin/fixjson',
\])
endfunction
function! ale#fixers#fixjson#Fix(buffer) abort
let l:executable = ale#Escape(ale#Var(a:buffer, 'json_fixjson_executable'))
let l:executable = ale#Escape(ale#fixers#fixjson#GetExecutable(a:buffer))
let l:filename = ale#Escape(bufname(a:buffer))
let l:command = l:executable . ' --stdin-filename ' . l:filename

View File

@ -40,6 +40,14 @@ g:ale_json_fixjson_options *g:ale_json_fixjson_options*
This variable can add extra options to the command executed for running
fixjson.
g:ale_json_fixjson_use_global *g:ale_json_fixjson_use_global*
*b:ale_json_fixjson_use_global*
Type: |Number|
Default: `0`
See |ale-integrations-local-executables|
===============================================================================
jsonlint *ale-json-jsonlint*