From 7ef55a86152c3e17e13702f0d9753d7fc9c4d256 Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 28 Jan 2018 11:51:20 +0000 Subject: [PATCH] #1303 jq isn't a Node program --- autoload/ale/fixers/jq.vim | 5 +---- doc/ale-json.txt | 10 +--------- test/fixers/test_jq_fixer_callback.vader | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 test/fixers/test_jq_fixer_callback.vader diff --git a/autoload/ale/fixers/jq.vim b/autoload/ale/fixers/jq.vim index 4604b24..b0a43fe 100644 --- a/autoload/ale/fixers/jq.vim +++ b/autoload/ale/fixers/jq.vim @@ -1,11 +1,8 @@ call ale#Set('json_jq_executable', 'jq') -call ale#Set('json_jq_use_global', 0) call ale#Set('json_jq_options', '') function! ale#fixers#jq#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'jq', [ - \ 'jq', - \]) + return ale#Var(a:buffer, 'json_jq_executable') endfunction function! ale#fixers#jq#Fix(buffer) abort diff --git a/doc/ale-json.txt b/doc/ale-json.txt index 6377833..1e97abc 100644 --- a/doc/ale-json.txt +++ b/doc/ale-json.txt @@ -63,15 +63,7 @@ g:ale_json_jq_executable *g:ale_json_jq_executable* Type: |String| Default: `'jq'` - See |ale-integrations-local-executables| - - -g:ale_json_jq_use_global *g:ale_json_jq_use_global* - *b:ale_json_jq_use_global* - Type: |Number| - Default: `0` - - See |ale-integrations-local-executables| + This option can be changed to change the path for `jq`. g:ale_json_jq_options *g:ale_json_jq_options* diff --git a/test/fixers/test_jq_fixer_callback.vader b/test/fixers/test_jq_fixer_callback.vader new file mode 100644 index 0000000..2e32bf8 --- /dev/null +++ b/test/fixers/test_jq_fixer_callback.vader @@ -0,0 +1,14 @@ +Before: + Save g:ale_json_jq_executable + Save g:ale_json_jq_options + +After: + Restore + +Execute(The jq fixer should use the options you set): + let g:ale_json_jq_executable = 'foo' + let g:ale_json_jq_options = '--bar' + + AssertEqual + \ {'command': ale#Escape('foo') . ' . --bar'}, + \ ale#fixers#jq#Fix(bufnr(''))