Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #1791 #2345

Merged
merged 5 commits into from
Apr 17, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ale_linters/haskell/cabal_ghc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion ale_linters/haskell/stack_ghc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not fix the issue for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm running Stack 1.9.3 (ghc nopie) on Arch Linux, and at this commit, stack is loading project modules correctly. What is your setup? Also, would it be possible to share an example project where you get the bug?

\ . ale#handlers#haskell#GetStackExecutable(a:buffer)
\ . ' ghc -- '
\ . ale#Var(a:buffer, 'haskell_stack_ghc_options')
\ . ' %t'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ After:

Execute(The options should be used in the command):
AssertEqual
\ 'cabal exec -- ghc -fno-code -v0 %t',
\ 'cd ''/testplugin'' && 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',
\ 'cd ''/testplugin'' && cabal exec -- ghc foobar %t',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can apply BufferCdString again here to fix this test.

\ ale_linters#haskell#cabal_ghc#GetCommand(bufnr(''))
Original file line number Diff line number Diff line change
Expand Up @@ -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'