Merge pull request #2235 from erydo/stack-ghc-options

Add g:haskell_stack_ghc_options like …_cabal_ghc_…
This commit is contained in:
w0rp 2019-01-27 10:20:46 +00:00 committed by GitHub
commit dd995d9aa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 1 deletions

View File

@ -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',
\})

View File

@ -107,6 +107,17 @@ g:ale_haskell_stack_build_options *g:ale_haskell_stack_build_options*
We default to using `'--fast'`. Since Stack generates binaries, your
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*

View File

@ -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|

View File

@ -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'