From 768f761017e4d67d8724684df874006d5b04147d Mon Sep 17 00:00:00 2001 From: Jake Zimmerman Date: Tue, 11 Jul 2017 07:05:13 -0500 Subject: [PATCH] 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 --- .../haskell/{stack-build.vim => stack_build.vim} | 10 +++++++++- .../haskell/{stack-ghc.vim => stack_ghc.vim} | 0 doc/ale-haskell.txt | 16 ++++++++++++++++ doc/ale.txt | 2 ++ 4 files changed, 27 insertions(+), 1 deletion(-) rename ale_linters/haskell/{stack-build.vim => stack_build.vim} (59%) rename ale_linters/haskell/{stack-ghc.vim => stack_ghc.vim} (100%) create mode 100644 doc/ale-haskell.txt diff --git a/ale_linters/haskell/stack-build.vim b/ale_linters/haskell/stack_build.vim similarity index 59% rename from ale_linters/haskell/stack-build.vim rename to ale_linters/haskell/stack_build.vim index 1c2a06f..525fd3f 100644 --- a/ale_linters/haskell/stack-build.vim +++ b/ale_linters/haskell/stack_build.vim @@ -4,11 +4,19 @@ " Note: Ideally, this would *only* typecheck. Right now, it also does codegen. " See . +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', { \ 'name': 'stack-build', \ 'output_stream': 'stderr', \ 'executable': 'stack', -\ 'command': 'stack build', +\ 'command_callback': 'ale_linters#haskell#stack_build#GetCommand', \ 'lint_file': 1, \ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \}) diff --git a/ale_linters/haskell/stack-ghc.vim b/ale_linters/haskell/stack_ghc.vim similarity index 100% rename from ale_linters/haskell/stack-ghc.vim rename to ale_linters/haskell/stack_ghc.vim diff --git a/doc/ale-haskell.txt b/doc/ale-haskell.txt new file mode 100644 index 0000000..34d897b --- /dev/null +++ b/doc/ale-haskell.txt @@ -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: diff --git a/doc/ale.txt b/doc/ale.txt index d678577..72c64f7 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -41,6 +41,8 @@ CONTENTS *ale-contents* gometalinter........................|ale-go-gometalinter| handlebars............................|ale-handlebars-options| ember-template-lint.................|ale-handlebars-embertemplatelint| + haskell...............................|ale-haskell-options| + stack-build.........................|ale-haskell-stack-build| html..................................|ale-html-options| htmlhint............................|ale-html-htmlhint| tidy................................|ale-html-tidy|