summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/floskell.vim20
2 files changed, 25 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 45da359a..4d28272a 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 <robertjlooby@gmail.com>
+" 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