2017-10-26 16:11:02 -07:00
|
|
|
" Author: Sam Howie <samhowie@gmail.com>
|
|
|
|
" Description: Integration of hackfmt with ALE.
|
|
|
|
|
2018-07-27 13:50:59 -07:00
|
|
|
call ale#Set('hack_hackfmt_executable', 'hackfmt')
|
|
|
|
call ale#Set('hack_hackfmt_options', '')
|
2017-10-26 16:11:02 -07:00
|
|
|
|
|
|
|
function! ale#fixers#hackfmt#Fix(buffer) abort
|
2018-07-27 13:50:59 -07:00
|
|
|
let l:executable = ale#Var(a:buffer, 'hack_hackfmt_executable')
|
|
|
|
let l:options = ale#Var(a:buffer, 'hack_hackfmt_options')
|
2017-10-26 16:11:02 -07:00
|
|
|
|
|
|
|
return {
|
|
|
|
\ 'command': ale#Escape(l:executable)
|
|
|
|
\ . ' -i'
|
|
|
|
\ . (empty(l:options) ? '' : ' ' . l:options)
|
|
|
|
\ . ' %t',
|
|
|
|
\ 'read_temporary_file': 1,
|
|
|
|
\}
|
|
|
|
endfunction
|