summaryrefslogtreecommitdiff
path: root/autoload/ale/fixers/fourmolu.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/ale/fixers/fourmolu.vim')
-rw-r--r--autoload/ale/fixers/fourmolu.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/autoload/ale/fixers/fourmolu.vim b/autoload/ale/fixers/fourmolu.vim
new file mode 100644
index 00000000..399ec0f4
--- /dev/null
+++ b/autoload/ale/fixers/fourmolu.vim
@@ -0,0 +1,20 @@
+call ale#Set('haskell_fourmolu_executable', 'fourmolu')
+call ale#Set('haskell_fourmolu_options', '')
+
+function! ale#fixers#fourmolu#GetExecutable(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'haskell_fourmolu_executable')
+
+ return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'fourmolu')
+endfunction
+
+function! ale#fixers#fourmolu#Fix(buffer) abort
+ let l:executable = ale#fixers#fourmolu#GetExecutable(a:buffer)
+ let l:options = ale#Var(a:buffer, 'haskell_fourmolu_options')
+
+ return {
+ \ 'command': l:executable
+ \ . (empty(l:options) ? '' : ' ' . l:options)
+ \ . ' --stdin-input-file '
+ \ . ale#Escape(@%),
+ \}
+endfunction