#1791 Set the working directory for cabal and stack

This commit is contained in:
Ian Shipman 2019-04-17 08:26:09 -05:00 committed by w0rp
parent 104980e40b
commit 2eb68f6d23
4 changed files with 8 additions and 6 deletions

View File

@ -4,7 +4,8 @@
call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0') call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0')
function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort 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') \ . ale#Var(a:buffer, 'haskell_cabal_ghc_options')
\ . ' %t' \ . ' %t'
endfunction endfunction

View File

@ -4,7 +4,8 @@
call ale#Set('haskell_stack_ghc_options', '-fno-code -v0') call ale#Set('haskell_stack_ghc_options', '-fno-code -v0')
function! ale_linters#haskell#stack_ghc#GetCommand(buffer) abort 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 -- ' \ . ' ghc -- '
\ . ale#Var(a:buffer, 'haskell_stack_ghc_options') \ . ale#Var(a:buffer, 'haskell_stack_ghc_options')
\ . ' %t' \ . ' %t'

View File

@ -13,11 +13,11 @@ After:
Execute(The options should be used in the command): Execute(The options should be used in the command):
AssertEqual 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('')) \ ale_linters#haskell#cabal_ghc#GetCommand(bufnr(''))
let b:ale_haskell_cabal_ghc_options = 'foobar' let b:ale_haskell_cabal_ghc_options = 'foobar'
AssertEqual AssertEqual
\ 'cabal exec -- ghc foobar %t', \ ale#path#BufferCdString(bufnr('')) . 'cabal exec -- ghc foobar %t',
\ ale_linters#haskell#cabal_ghc#GetCommand(bufnr('')) \ ale_linters#haskell#cabal_ghc#GetCommand(bufnr(''))

View File

@ -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): Execute(The linter should be executed when there is a stack.yaml file):
call ale#test#SetFilename('stack_ghc_paths/test.hs') 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' let b:ale_haskell_stack_ghc_options = 'foobar'
AssertLinter 'stack', 'stack ghc -- foobar %t' AssertLinter 'stack', ale#path#BufferCdString(bufnr('')) . 'stack ghc -- foobar %t'