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`.
This commit is contained in:
Evan Rutledge Borden
2017-11-28 17:58:13 -05:00
parent a43ada93e4
commit edb3a0c5e4
6 changed files with 55 additions and 1 deletions

View File

@@ -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'],

View File

@@ -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