Closed
Description
Implement something similar to the following code:
ftplugin/json.vim:
let b:ale_fixers = ['json_python_fixer] let b:ale_json_python_fixer_options = '--indent 2'
autoload/ale/fixers/json_python_fixer.vim:
" Description: Fix JSON files with "python -m json.tool"
call ale#Set('json_python_fixer_options', '')
function! ale#fixers#json_python_fixer#Fix(buffer) abort
let l:command = 'python'
if !executable(l:command)
echo 'ALEFix: ' . l:command . ' executable not found'
return {'command': 'REM'}
endif
let l:command .= ' -m json.tool'
let l:options = ale#Var(a:buffer, 'json_python_fixer_options')
if len(l:options)
let l:command .= ' ' . l:options
endif
return { 'command': l:command . ' -'}
endfunction
Activity