carymrobbins / intellij-haskforce

Haskell plugin for IntelliJ IDEA
http://carymrobbins.github.io/intellij-haskforce/
Apache License 2.0
486 stars 39 forks source link

ghc-mod should use root command for work dir #213

Open donut opened 8 years ago

donut commented 8 years ago

I'm running into this error. Looks like anything that uses ghc-mod is broken.

11:10:12 ghc-modi error
         Unable to parse problems from ghc-modi: You must run ghc-mod in the project directory as returned by `ghc-mod root`. Currently in: "/Users/me/project/.idea"but should be in "/Users/me/project".
         Configure
11:10:12 ghc-modi error
         Killing ghc-modi due to process failure.
         You can restart it using Tools > Restart ghc-modi
         Executing ghc-modi command 'browse -d Control.Monad' failed with error: Failed to write command to ghc-modi:

ghc-mod version 5.4.0.0 compiled by GHC 7.10.2 ghc-modi version 5.4.0.0 compiled by GHC 7.10.2 (but using ghc-mod legacy-interactive) IntelliJ IDEA (Community Edition) IC-143.1183.10 HaskForce 0.3-beta.25 Mac OS X 10.11.1

carymrobbins commented 8 years ago

Thanks for the report @donut.

Technical Notes - We need to implement ghc-mod root <file> and use its result as the working directory. I'm thinking a method like String root(String path) which gets called for commands. It'll probably require some light refactoring of the command methods as well.

donut commented 8 years ago

Any ideas about what might be different about my setup that's revealing this bug?

carymrobbins commented 8 years ago

@donut - Yes, I should have mentioned that. It seems your module files (the .iml ones) are in your .idea/ directory. Ideally, they should reside alongside each corresponding .cabal file. If you are using Stack, you can try to import the project following the steps outlined in the quick start guide. For best results, close the project, remove the .idea directory, and then try to import the project using the Stack model.

donut commented 8 years ago

That worked. Thank you!

carymrobbins commented 8 years ago

I'll still leave this open until I implement the ghc-mod root command to avoid folks running into this in the future.

a10nik commented 8 years ago

by the way, since this issue has been fixed ghc-mod soon will not have that ugly requirement anymore. it was initially introduced in 5.4.0 version of ghc-mod to avoid some race conditions and has been spoiling lives of vim users since than. after 5.5.0 it will no longer, as it seems

carymrobbins commented 8 years ago

@a10nik - Thanks for bringing this up. I will leave this open until I get a chance to confirm that it works well with 5.5.0.