summaryrefslogtreecommitdiff
path: root/ale_linters/haskell/stack_ghc.vim
diff options
context:
space:
mode:
authorRobert Estelle <robertestelle@gmail.com>2019-01-22 09:22:49 -0500
committerRobert Estelle <robertestelle@gmail.com>2019-01-22 09:46:08 -0500
commite273f678fffe190ba3b22995ca8d91ab60fcf88d (patch)
treefd227afd7b1c847dcb084541ea8a485d0d5ad93b /ale_linters/haskell/stack_ghc.vim
parentf12d312aa4aa49c4698056933030cd5adb60b489 (diff)
downloadale-e273f678fffe190ba3b22995ca8d91ab60fcf88d.zip
Add haskell_stack_ghc_options like …_cabal_ghc_…
Adds new option `g:haskell_stack_ghc_options` which passes options to `stack ghc`. This is implemented similiarly to `g:haskell_cabal_ghc_options`.
Diffstat (limited to 'ale_linters/haskell/stack_ghc.vim')
-rw-r--r--ale_linters/haskell/stack_ghc.vim11
1 files changed, 10 insertions, 1 deletions
diff --git a/ale_linters/haskell/stack_ghc.vim b/ale_linters/haskell/stack_ghc.vim
index 8f42b96c..99aa2540 100644
--- a/ale_linters/haskell/stack_ghc.vim
+++ b/ale_linters/haskell/stack_ghc.vim
@@ -1,11 +1,20 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: ghc for Haskell files, using Stack
+call ale#Set('haskell_stack_ghc_options', '-fno-code -v0')
+
+function! ale_linters#haskell#stack_ghc#GetCommand(buffer) abort
+ return ale#handlers#haskell#GetStackExecutable(a:buffer)
+ \ . ' ghc -- '
+ \ . ale#Var(a:buffer, 'haskell_stack_ghc_options')
+ \ . ' %t'
+endfunction
+
call ale#linter#Define('haskell', {
\ 'name': 'stack_ghc',
\ 'aliases': ['stack-ghc'],
\ 'output_stream': 'stderr',
\ 'executable_callback': 'ale#handlers#haskell#GetStackExecutable',
-\ 'command': 'stack ghc -- -fno-code -v0 %t',
+\ 'command_callback': 'ale_linters#haskell#stack_ghc#GetCommand',
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
\})