summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Shipman <ics.github@gambolingpangolin.com>2019-04-17 08:26:09 -0500
committerw0rp <w0rp@users.noreply.github.com>2019-04-17 14:26:09 +0100
commit2eb68f6d23f51c33f3d64a15172c869e71d7829b (patch)
treef7fc87ffc40668159c21f5d1261a82bbb07163eb
parent104980e40bf2d2fdd100c04aba73d5c1ad2660ab (diff)
downloadale-2eb68f6d23f51c33f3d64a15172c869e71d7829b.zip
#1791 Set the working directory for cabal and stack
-rw-r--r--ale_linters/haskell/cabal_ghc.vim3
-rw-r--r--ale_linters/haskell/stack_ghc.vim3
-rw-r--r--test/command_callback/test_haskell_cabal_ghc_command_callbacks.vader4
-rw-r--r--test/command_callback/test_haskell_stack_ghc_command_callback.vader4
4 files changed, 8 insertions, 6 deletions
diff --git a/ale_linters/haskell/cabal_ghc.vim b/ale_linters/haskell/cabal_ghc.vim
index 59978e7e..f3f248f5 100644
--- a/ale_linters/haskell/cabal_ghc.vim
+++ b/ale_linters/haskell/cabal_ghc.vim
@@ -4,7 +4,8 @@
call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0')
function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort
- return 'cabal exec -- ghc '
+ return ale#path#BufferCdString(a:buffer)
+ \ . 'cabal exec -- ghc '
\ . ale#Var(a:buffer, 'haskell_cabal_ghc_options')
\ . ' %t'
endfunction
diff --git a/ale_linters/haskell/stack_ghc.vim b/ale_linters/haskell/stack_ghc.vim
index 06af7f6d..c345fe43 100644
--- a/ale_linters/haskell/stack_ghc.vim
+++ b/ale_linters/haskell/stack_ghc.vim
@@ -4,7 +4,8 @@
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)
+ return ale#path#BufferCdString(a:buffer)
+ \ . ale#handlers#haskell#GetStackExecutable(a:buffer)
\ . ' ghc -- '
\ . ale#Var(a:buffer, 'haskell_stack_ghc_options')
\ . ' %t'
diff --git a/test/command_callback/test_haskell_cabal_ghc_command_callbacks.vader b/test/command_callback/test_haskell_cabal_ghc_command_callbacks.vader
index 650aefa3..9e3712d6 100644
--- a/test/command_callback/test_haskell_cabal_ghc_command_callbacks.vader
+++ b/test/command_callback/test_haskell_cabal_ghc_command_callbacks.vader
@@ -13,11 +13,11 @@ After:
Execute(The options should be used in the command):
AssertEqual
- \ 'cabal exec -- ghc -fno-code -v0 %t',
+ \ ale#path#BufferCdString(bufnr('')) . 'cabal exec -- ghc -fno-code -v0 %t',
\ ale_linters#haskell#cabal_ghc#GetCommand(bufnr(''))
let b:ale_haskell_cabal_ghc_options = 'foobar'
AssertEqual
- \ 'cabal exec -- ghc foobar %t',
+ \ ale#path#BufferCdString(bufnr('')) . 'cabal exec -- ghc foobar %t',
\ ale_linters#haskell#cabal_ghc#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_haskell_stack_ghc_command_callback.vader b/test/command_callback/test_haskell_stack_ghc_command_callback.vader
index f58f8b5f..aa13fb2b 100644
--- a/test/command_callback/test_haskell_stack_ghc_command_callback.vader
+++ b/test/command_callback/test_haskell_stack_ghc_command_callback.vader
@@ -10,8 +10,8 @@ Execute(The linter should not be executed when there's no stack.yaml file):
Execute(The linter should be executed when there is a stack.yaml file):
call ale#test#SetFilename('stack_ghc_paths/test.hs')
- AssertLinter 'stack', 'stack ghc -- -fno-code -v0 %t'
+ AssertLinter 'stack', ale#path#BufferCdString(bufnr('')) . 'stack ghc -- -fno-code -v0 %t'
let b:ale_haskell_stack_ghc_options = 'foobar'
- AssertLinter 'stack', 'stack ghc -- foobar %t'
+ AssertLinter 'stack', ale#path#BufferCdString(bufnr('')) . 'stack ghc -- foobar %t'