summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fixers/brittany.vim10
-rw-r--r--autoload/ale/fixers/hfmt.vim2
-rw-r--r--autoload/ale/fixers/hlint.vim5
-rw-r--r--autoload/ale/fixers/stylish_haskell.vim10
-rw-r--r--autoload/ale/handlers/haskell_stack.vim7
-rw-r--r--autoload/ale/handlers/hlint.vim8
6 files changed, 33 insertions, 9 deletions
diff --git a/autoload/ale/fixers/brittany.vim b/autoload/ale/fixers/brittany.vim
index 57c77325..c2448348 100644
--- a/autoload/ale/fixers/brittany.vim
+++ b/autoload/ale/fixers/brittany.vim
@@ -3,11 +3,17 @@
call ale#Set('haskell_brittany_executable', 'brittany')
-function! ale#fixers#brittany#Fix(buffer) abort
+function! ale#fixers#brittany#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_brittany_executable')
+ return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'brittany')
+endfunction
+
+function! ale#fixers#brittany#Fix(buffer) abort
+ let l:executable = ale#fixers#brittany#GetExecutable(a:buffer)
+
return {
- \ 'command': ale#Escape(l:executable)
+ \ 'command': l:executable
\ . ' --write-mode inplace'
\ . ' %t',
\ 'read_temporary_file': 1,
diff --git a/autoload/ale/fixers/hfmt.vim b/autoload/ale/fixers/hfmt.vim
index ea061da4..0407b713 100644
--- a/autoload/ale/fixers/hfmt.vim
+++ b/autoload/ale/fixers/hfmt.vim
@@ -7,7 +7,7 @@ function! ale#fixers#hfmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_hfmt_executable')
return {
- \ 'command': ale#Escape(l:executable)
+ \ 'command': ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hfmt')
\ . ' -w'
\ . ' %t',
\ 'read_temporary_file': 1,
diff --git a/autoload/ale/fixers/hlint.vim b/autoload/ale/fixers/hlint.vim
index 94dd736e..88779a55 100644
--- a/autoload/ale/fixers/hlint.vim
+++ b/autoload/ale/fixers/hlint.vim
@@ -1,13 +1,10 @@
" Author: eborden <evan@evan-borden.com>
" Description: Integration of hlint refactor with ALE.
"
-call ale#Set('haskell_hlint_executable', 'hlint')
function! ale#fixers#hlint#Fix(buffer) abort
- let l:executable = ale#Var(a:buffer, 'haskell_hlint_executable')
-
return {
- \ 'command': ale#Escape(l:executable)
+ \ 'command': ale#handlers#hlint#GetExecutable(a:buffer)
\ . ' --refactor'
\ . ' --refactor-options="--inplace"'
\ . ' %t',
diff --git a/autoload/ale/fixers/stylish_haskell.vim b/autoload/ale/fixers/stylish_haskell.vim
index a352312f..ce71c1ce 100644
--- a/autoload/ale/fixers/stylish_haskell.vim
+++ b/autoload/ale/fixers/stylish_haskell.vim
@@ -3,11 +3,17 @@
"
call ale#Set('haskell_stylish_haskell_executable', 'stylish-haskell')
-function! ale#fixers#stylish_haskell#Fix(buffer) abort
+function! ale#fixers#stylish_haskell#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_stylish_haskell_executable')
+ return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'stylish-haskell')
+endfunction
+
+function! ale#fixers#stylish_haskell#Fix(buffer) abort
+ let l:executable = ale#fixers#stylish_haskell#GetExecutable(a:buffer)
+
return {
- \ 'command': ale#Escape(l:executable)
+ \ 'command': l:executable
\ . ' --inplace'
\ . ' %t',
\ 'read_temporary_file': 1,
diff --git a/autoload/ale/handlers/haskell_stack.vim b/autoload/ale/handlers/haskell_stack.vim
new file mode 100644
index 00000000..108301a9
--- /dev/null
+++ b/autoload/ale/handlers/haskell_stack.vim
@@ -0,0 +1,7 @@
+function! ale#handlers#haskell_stack#EscapeExecutable(executable, stack_exec) abort
+ let l:exec_args = a:executable =~? 'stack$'
+ \ ? ' exec ' . ale#Escape(a:stack_exec) . ' --'
+ \ : ''
+
+ return ale#Escape(a:executable) . l:exec_args
+endfunction
diff --git a/autoload/ale/handlers/hlint.vim b/autoload/ale/handlers/hlint.vim
new file mode 100644
index 00000000..b9a8c322
--- /dev/null
+++ b/autoload/ale/handlers/hlint.vim
@@ -0,0 +1,8 @@
+call ale#Set('haskell_hlint_executable', 'hlint')
+call ale#Set('haskell_hlint_options', get(g:, 'hlint_options', ''))
+
+function! ale#handlers#hlint#GetExecutable(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'haskell_hlint_executable')
+
+ return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hlint')
+endfunction