diff options
author | Robert Estelle <robertestelle@gmail.com> | 2019-01-22 09:22:49 -0500 |
---|---|---|
committer | Robert Estelle <robertestelle@gmail.com> | 2019-01-22 09:46:08 -0500 |
commit | e273f678fffe190ba3b22995ca8d91ab60fcf88d (patch) | |
tree | fd227afd7b1c847dcb084541ea8a485d0d5ad93b | |
parent | f12d312aa4aa49c4698056933030cd5adb60b489 (diff) | |
download | ale-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`.
-rw-r--r-- | ale_linters/haskell/stack_ghc.vim | 11 | ||||
-rw-r--r-- | doc/ale-haskell.txt | 11 | ||||
-rw-r--r-- | doc/ale.txt | 1 | ||||
-rw-r--r-- | test/command_callback/test_haskell_stack_ghc_command_callback.vader | 3 |
4 files changed, 25 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', \}) diff --git a/doc/ale-haskell.txt b/doc/ale-haskell.txt index a4db683b..2247eddc 100644 --- a/doc/ale-haskell.txt +++ b/doc/ale-haskell.txt @@ -108,6 +108,17 @@ g:ale_haskell_stack_build_options *g:ale_haskell_stack_build_options* programs will be slower unless you separately rebuild them outside of ALE. =============================================================================== +stack-ghc *ale-haskell-stack-ghc* + +g:ale_haskell_stack_ghc_options *g:ale_haskell_stack_ghc_options* + *b:ale_haskell_stack_ghc_options* + Type: |String| + Default: `'-fno-code -v0'` + + This variable can be changed to modify flags given to ghc through `stack + ghc` + +=============================================================================== stylish-haskell *ale-haskell-stylish-haskell* g:ale_haskell_stylish_haskell_executable diff --git a/doc/ale.txt b/doc/ale.txt index ac71ab83..54d63741 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -140,6 +140,7 @@ CONTENTS *ale-contents* hfmt................................|ale-haskell-hfmt| hlint...............................|ale-haskell-hlint| stack-build.........................|ale-haskell-stack-build| + stack-ghc...........................|ale-haskell-stack-ghc| stylish-haskell.....................|ale-haskell-stylish-haskell| hie.................................|ale-haskell-hie| hcl...................................|ale-hcl-options| diff --git a/test/command_callback/test_haskell_stack_ghc_command_callback.vader b/test/command_callback/test_haskell_stack_ghc_command_callback.vader index 4adab583..f58f8b5f 100644 --- a/test/command_callback/test_haskell_stack_ghc_command_callback.vader +++ b/test/command_callback/test_haskell_stack_ghc_command_callback.vader @@ -12,3 +12,6 @@ Execute(The linter should be executed when there is a stack.yaml file): AssertLinter 'stack', 'stack ghc -- -fno-code -v0 %t' + let b:ale_haskell_stack_ghc_options = 'foobar' + + AssertLinter 'stack', 'stack ghc -- foobar %t' |