Add stylish-haskell as a fixer (#1837)

* Add stylish-haskell as a fixer

`stylish-haskell` is a common formatting tool for the haskell toolchain.
It is not as advanced as `brittany` or `hindent`, but it is commonly
used for formatting of imports and data declarations. This adds it as a
fixer in ALE.
This commit is contained in:
Evan Borden
2018-08-23 23:14:59 +01:00
committed by w0rp
parent 81d0eccfab
commit 2600524274
6 changed files with 57 additions and 2 deletions
+5
View File
@@ -170,6 +170,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['haskell'],
\ 'description': 'Fix Haskell files with brittany.',
\ },
\ 'stylish-haskell': {
\ 'function': 'ale#fixers#stylish_haskell#Fix',
\ 'suggested_filetypes': ['haskell'],
\ 'description': 'Refactor Haskell files with stylish-haskell.',
\ },
\ 'refmt': {
\ 'function': 'ale#fixers#refmt#Fix',
\ 'suggested_filetypes': ['reason'],
+15
View File
@@ -0,0 +1,15 @@
" Author: eborden <evan@evan-borden.com>
" Description: Integration of stylish-haskell formatting with ALE.
"
call ale#Set('haskell_stylish_haskell_executable', 'stylish-haskell')
function! ale#fixers#stylish_haskell#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_stylish_haskell_executable')
return {
\ 'command': ale#Escape(l:executable)
\ . ' --inplace'
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction