diff options
author | Sam Howie <showie@dev14483.prn1.facebook.com> | 2017-10-26 16:11:02 -0700 |
---|---|---|
committer | Sam Howie <samhowie@gmail.com> | 2017-10-27 13:42:55 -0700 |
commit | 36898436b53f8f7df7790ce3ce0681cfd4c9bdb6 (patch) | |
tree | 9f8ac7eceb95d1e866047317847125ee36c146eb /autoload | |
parent | 73b8181ce65ab8386d0fb900954757d740b600d2 (diff) | |
download | ale-36898436b53f8f7df7790ce3ce0681cfd4c9bdb6.zip |
Add hackfmt fixer
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/hackfmt.vim | 18 |
2 files changed, 23 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index bbdcc430..5aa78ac5 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -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'], diff --git a/autoload/ale/fixers/hackfmt.vim b/autoload/ale/fixers/hackfmt.vim new file mode 100644 index 00000000..b5bf0dc5 --- /dev/null +++ b/autoload/ale/fixers/hackfmt.vim @@ -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 |