Prefer --fast for stack-build (#754)

* Vim scripts shouldn't have hyphens

Especially not ones that will be autoloaded. You can't have a hyphen in
a function name, so autoloading functions based on filename will fail.

* Add g:haskell_stack_build_options, default: --fast

If we're going to use the --fast option, we may as well go the whole 9
yards and let the user configure the 'stack build' flags.

* Create documentation for stack-build options
This commit is contained in:
Jake Zimmerman 2017-07-11 07:05:13 -05:00 committed by w0rp
parent 05d3bb12dd
commit 768f761017
4 changed files with 27 additions and 1 deletions

View File

@ -4,11 +4,19 @@
" Note: Ideally, this would *only* typecheck. Right now, it also does codegen. " Note: Ideally, this would *only* typecheck. Right now, it also does codegen.
" See <https://github.com/commercialhaskell/stack/issues/977>. " See <https://github.com/commercialhaskell/stack/issues/977>.
call ale#Set('haskell_stack_build_options', '--fast')
function ale_linters#haskell#stack_build#GetCommand(buffer) abort
let l:flags = ale#Var(a:buffer, 'haskell_stack_build_options')
return 'stack build ' . l:flags
endfunction
call ale#linter#Define('haskell', { call ale#linter#Define('haskell', {
\ 'name': 'stack-build', \ 'name': 'stack-build',
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable': 'stack', \ 'executable': 'stack',
\ 'command': 'stack build', \ 'command_callback': 'ale_linters#haskell#stack_build#GetCommand',
\ 'lint_file': 1, \ 'lint_file': 1,
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
\}) \})

16
doc/ale-haskell.txt Normal file
View File

@ -0,0 +1,16 @@
===============================================================================
ALE Haskell Integration *ale-haskell-options*
===============================================================================
stack-build *ale-haskell-stack-build*
g:ale_haskell_stack_build_options *g:ale_haskell_stack_build_options*
*b:ale_haskell_stack_build_options*
Type: |String|
Default: `'--fast'`
We default to using `'--fast'`. Since Stack generates binaries, your
programs will be slower unless you separately rebuild them outside of ALE.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -41,6 +41,8 @@ CONTENTS *ale-contents*
gometalinter........................|ale-go-gometalinter| gometalinter........................|ale-go-gometalinter|
handlebars............................|ale-handlebars-options| handlebars............................|ale-handlebars-options|
ember-template-lint.................|ale-handlebars-embertemplatelint| ember-template-lint.................|ale-handlebars-embertemplatelint|
haskell...............................|ale-haskell-options|
stack-build.........................|ale-haskell-stack-build|
html..................................|ale-html-options| html..................................|ale-html-options|
htmlhint............................|ale-html-htmlhint| htmlhint............................|ale-html-htmlhint|
tidy................................|ale-html-tidy| tidy................................|ale-html-tidy|