diff options
author | Aliou Diallo <aliou@users.noreply.github.com> | 2018-10-12 10:15:32 +0200 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2018-10-12 09:15:32 +0100 |
commit | b7ec11c93d12ce8f64cfdae363cbab3d2e69dfd4 (patch) | |
tree | b7c134db03184b1ff2c8df98fa4876508e202420 /autoload | |
parent | e5b5ce9f512d4a36e944f728f4d1ff5d8238c64f (diff) | |
download | ale-b7ec11c93d12ce8f64cfdae363cbab3d2e69dfd4.zip |
Allow custom filters for the jq fixer (#1980)
* Allow the jq filters to receive custom filters.
* Update documentation.
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fixers/jq.vim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/autoload/ale/fixers/jq.vim b/autoload/ale/fixers/jq.vim index b0a43fe2..1b743e49 100644 --- a/autoload/ale/fixers/jq.vim +++ b/autoload/ale/fixers/jq.vim @@ -1,5 +1,6 @@ call ale#Set('json_jq_executable', 'jq') call ale#Set('json_jq_options', '') +call ale#Set('json_jq_filters', '.') function! ale#fixers#jq#GetExecutable(buffer) abort return ale#Var(a:buffer, 'json_jq_executable') @@ -7,9 +8,15 @@ endfunction function! ale#fixers#jq#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'json_jq_options') + let l:filters = ale#Var(a:buffer, 'json_jq_filters') + + if empty(l:filters) + return 0 + endif return { \ 'command': ale#Escape(ale#fixers#jq#GetExecutable(a:buffer)) - \ . ' . ' . l:options, + \ . ' ' . l:filters . ' ' + \ . l:options, \} endfunction |