Add hackfmt fixer
This commit is contained in:
@@ -117,6 +117,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['rust'],
|
||||
\ 'description': 'Fix Rust files with Rustfmt.',
|
||||
\ },
|
||||
\ 'hackfmt': {
|
||||
\ 'function': 'ale#fixers#hackfmt#Fix',
|
||||
\ 'suggested_filetypes': ['php'],
|
||||
\ 'description': 'Fix Hack files with hackfmt.',
|
||||
\ },
|
||||
\ 'hfmt': {
|
||||
\ 'function': 'ale#fixers#hfmt#Fix',
|
||||
\ 'suggested_filetypes': ['haskell'],
|
||||
|
||||
18
autoload/ale/fixers/hackfmt.vim
Normal file
18
autoload/ale/fixers/hackfmt.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
" Author: Sam Howie <samhowie@gmail.com>
|
||||
" Description: Integration of hackfmt with ALE.
|
||||
|
||||
call ale#Set('php_hackfmt_executable', 'hackfmt')
|
||||
call ale#Set('php_hackfmt_options', '')
|
||||
|
||||
function! ale#fixers#hackfmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'php_hackfmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'php_hackfmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -i'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user