From 2eb68f6d23f51c33f3d64a15172c869e71d7829b Mon Sep 17 00:00:00 2001 From: Ian Shipman Date: Wed, 17 Apr 2019 08:26:09 -0500 Subject: [PATCH] #1791 Set the working directory for cabal and stack --- ale_linters/haskell/cabal_ghc.vim | 3 ++- ale_linters/haskell/stack_ghc.vim | 3 ++- .../test_haskell_cabal_ghc_command_callbacks.vader | 4 ++-- .../test_haskell_stack_ghc_command_callback.vader | 4 ++-- 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'