diff options
author | Evan Rutledge Borden <eborden@frontrowed.com> | 2017-11-28 17:58:13 -0500 |
---|---|---|
committer | Evan Rutledge Borden <eborden@frontrowed.com> | 2017-11-28 17:58:13 -0500 |
commit | edb3a0c5e4079708b915e6227541e4e1fae9f712 (patch) | |
tree | 5f74c808ab817d4d061c473525e91885620c2809 /autoload | |
parent | a43ada93e40b8286dde3cd62f10369876787ddc1 (diff) | |
download | ale-edb3a0c5e4079708b915e6227541e4e1fae9f712.zip |
Add brittany for Haskell formatting
`brittany` is one of the options for Haskell source formatting. This
adds the necessary fixer files and documentation to support `brittany`
in `ALE`.
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/brittany.vim | 15 |
2 files changed, 20 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 4fb229bd..dd63a804 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -134,6 +134,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['haskell'], \ 'description': 'Fix Haskell files with hfmt.', \ }, +\ 'brittany': { +\ 'function': 'ale#fixers#brittany#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'Fix Haskell files with brittany.', +\ }, \ 'refmt': { \ 'function': 'ale#fixers#refmt#Fix', \ 'suggested_filetypes': ['reason'], diff --git a/autoload/ale/fixers/brittany.vim b/autoload/ale/fixers/brittany.vim new file mode 100644 index 00000000..fed5eb8b --- /dev/null +++ b/autoload/ale/fixers/brittany.vim @@ -0,0 +1,15 @@ +" Author: eborden <evan@evan-borden.com> +" Description: Integration of brittany with ALE. + +call ale#Set('haskell_brittany_executable', 'brittany') + +function! ale#fixers#brittany#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_brittany_executable') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction + |