From ef898fa3033c10a6176995aba4ccb4567c85e601 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 25 Jan 2018 03:45:07 +0900 Subject: [PATCH] fixjson: Add support for local installation --- autoload/ale/fixers/fixjson.vim | 9 ++++++++- doc/ale-json.txt | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/autoload/ale/fixers/fixjson.vim b/autoload/ale/fixers/fixjson.vim index 84728f24..43eb0632 100644 --- a/autoload/ale/fixers/fixjson.vim +++ b/autoload/ale/fixers/fixjson.vim @@ -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 diff --git a/doc/ale-json.txt b/doc/ale-json.txt index b8e13cdb..63778331 100644 --- a/doc/ale-json.txt +++ b/doc/ale-json.txt @@ -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*