From a8915d885b79ba8e243c228c9f38dddbcb1c479a Mon Sep 17 00:00:00 2001 From: Evan Borden Date: Fri, 28 Sep 2018 04:05:01 -0400 Subject: Add better support for Haskell stack compiler tools (#1851) * Add better support for Haskell stack compiler tools This commit adds support for `stack` as the executable of a tool. This follows a pattern that has been implemented for `bundler`'s tool chain. * Move hlint command to linter file * Add vader test for stack exec handling * Update ghc-mod to support stack execution `ghc-mod` was previously broken into 2 linters. 1. ghc_mod 2. stack_ghc_mod This additional linter is not necessary with proper support for executable variables and `stack exec` handling. * Support stack exec in hfmt * Support stack in hdevtools --- ale_linters/haskell/hie.vim | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'ale_linters/haskell/hie.vim') diff --git a/ale_linters/haskell/hie.vim b/ale_linters/haskell/hie.vim index 558d36a3..3ff1180a 100644 --- a/ale_linters/haskell/hie.vim +++ b/ale_linters/haskell/hie.vim @@ -3,10 +3,6 @@ call ale#Set('haskell_hie_executable', 'hie') -function! ale_linters#haskell#hie#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'haskell_hie_executable') -endfunction - function! ale_linters#haskell#hie#GetProjectRoot(buffer) abort " Search for the stack file first let l:project_file = ale#path#FindNearestFile(a:buffer, 'stack.yaml') @@ -35,10 +31,17 @@ function! ale_linters#haskell#hie#GetProjectRoot(buffer) abort return l:project_file endfunction +function! ale_linters#haskell#hie#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_hie_executable') + + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hie') +\ . ' --lsp' +endfunction + call ale#linter#Define('haskell', { \ 'name': 'hie', \ 'lsp': 'stdio', -\ 'command': '%e --lsp', -\ 'executable_callback': 'ale_linters#haskell#hie#GetExecutable', +\ 'command_callback': 'ale_linters#haskell#hie#GetCommand', +\ 'executable_callback': ale#VarFunc('haskell_hie_executable'), \ 'project_root_callback': 'ale_linters#haskell#hie#GetProjectRoot', \}) -- cgit v1.2.3