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

Cabal instructions don't work #152

Open
hasufell opened this issue Jun 14, 2018 · 7 comments
Open

Cabal instructions don't work #152

hasufell opened this issue Jun 14, 2018 · 7 comments

Comments

@hasufell
Copy link

I set the cabal new-repl instructions and they don't work:

Calling type info yields:

Undefined variable g:intero_backend_info
Invalid arguments for function intero#process#backend_info#version_gte
Invalid expression: intero#process#backend_info#version_gte( g:intero_Backend_info.version [8, 0, 1])

InterOpen yields:

No cabal.project file or cabal file matching the default gl
ob './*.cabal' was found.
Please create a package description file <pkgname>.cabal or
 a cabal.project file referencing the packages you want to
build.


[Process exited 1]
@vasalf
Copy link

vasalf commented May 29, 2019

I'm facing the same issue right now. Is there any workaround?

@parsonsmatt
Copy link
Owner

@owickstrom any thoughts?

@vasalf
Copy link

vasalf commented May 30, 2019

It seems that if I open file src/Main.hs, intero-neovim runs cabal in src/, not in ., so cabal doesn't see my <pkgname>.cabal file.
I guess it is controlled by cwd parameter for intero_backend. I'll now try to find out what should I write there to make it work.

@vasalf
Copy link

vasalf commented May 30, 2019

I only deleted the cwd line from the config and it worked.
Hope it helps others facing the same issue.
@parsonsmatt maybe there should be a note about that in README?

@parsonsmatt
Copy link
Owner

I don't use cabal work flows so I'm not sure what would be helpful - a PR would be welcome 😄

@owickstrom
Copy link
Collaborator

@hasufell @vasalf It's been a while since I used this plugin, but I can think of a few options (untested):

  1. Set the cwd to a string with the absolute path to your project directory containing the .cabal file (you can use .nvimrc files to set it per-project)
  2. Use plain ghci instead of cabal new-repl (if you have Cabal write the GHC environment file then GHCi will pick it up, but you might need to add -isrc or similar for source directories)
  3. Qualify the REPL command with an explicit target, e.g. cabal new-repl exe:my-project-app

And yeah, that example config used a Vim function to expand the directory path of the current file, I think. Maybe that should be removed from the example, not sure why it's there.

@alexkalderimis
Copy link

In my case, I have the following in my project-local .nvimrc file and it works correctly:

let g:intero_backend = {
        \ 'command': 'cabal new-repl'
        \}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants