Only run stack if a stack.yaml config is found (#1752)

* Only run stack if a stack.yaml config is found

It is necessary to check for a stack.yaml file to distinguish between
cabal-only projects or stack projects (which are also cabal projects
since stack is built on top of cabal).

* Test that stack is called if stack.yaml exists
This commit is contained in:
Anthony Poon
2018-10-26 01:30:49 +11:00
committed by w0rp
parent 9bdd5771ef
commit 02c0d5bcb9
7 changed files with 39 additions and 2 deletions

View File

@@ -1,5 +1,15 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: Error handling for the format GHC outputs.
"
function! ale#handlers#haskell#GetStackExecutable(bufnr) abort
if ale#path#FindNearestFile(a:bufnr, 'stack.yaml') isnot# ''
return 'stack'
endif
" if there is no stack.yaml file, we don't use stack even if it exists,
" so we return '', because executable('') apparently always fails
return ''
endfunction
" Remember the directory used for temporary files for Vim.
let s:temp_dir = fnamemodify(ale#util#Tempname(), ':h')