From 99361b2ca92bb6b70056ee558088e386745435a6 Mon Sep 17 00:00:00 2001 From: Rob Looby Date: Sun, 14 Apr 2019 11:18:50 -0500 Subject: Add floskell for Haskell formatting --- autoload/ale/fix/registry.vim | 5 +++++ autoload/ale/fixers/floskell.vim | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 autoload/ale/fixers/floskell.vim (limited to 'autoload') diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 2b43e40a..430dc7db 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -190,6 +190,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['hack'], \ 'description': 'Fix Hack files with hackfmt.', \ }, +\ 'floskell': { +\ 'function': 'ale#fixers#floskell#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'Fix Haskell files with floskell.', +\ }, \ 'hfmt': { \ 'function': 'ale#fixers#hfmt#Fix', \ 'suggested_filetypes': ['haskell'], diff --git a/autoload/ale/fixers/floskell.vim b/autoload/ale/fixers/floskell.vim new file mode 100644 index 00000000..f0015db7 --- /dev/null +++ b/autoload/ale/fixers/floskell.vim @@ -0,0 +1,20 @@ +" Author: robertjlooby +" Description: Integration of floskell with ALE. + +call ale#Set('haskell_floskell_executable', 'floskell') + +function! ale#fixers#floskell#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_floskell_executable') + + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'floskell') +endfunction + +function! ale#fixers#floskell#Fix(buffer) abort + let l:executable = ale#fixers#floskell#GetExecutable(a:buffer) + + return { + \ 'command': l:executable + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction -- cgit v1.2.3