diff options
author | Evan Borden <eborden@users.noreply.github.com> | 2018-08-23 18:14:59 -0400 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2018-08-23 23:14:59 +0100 |
commit | 26005242744c6d88f0ec728964754909f4a73d94 (patch) | |
tree | 151f180a53f8d0e025a555699c0cf024d94e3896 /autoload | |
parent | 81d0eccfab4aa194702b71cf7f950c0fdcbd3caa (diff) | |
download | ale-26005242744c6d88f0ec728964754909f4a73d94.zip |
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.
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/stylish_haskell.vim | 15 |
2 files changed, 20 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index ef287358..60de4a46 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -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'], diff --git a/autoload/ale/fixers/stylish_haskell.vim b/autoload/ale/fixers/stylish_haskell.vim new file mode 100644 index 00000000..a352312f --- /dev/null +++ b/autoload/ale/fixers/stylish_haskell.vim @@ -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 |