haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 213 forks source link

Hie crashes Coc Neovim #1761

Closed Eugene-msc closed 4 years ago

Eugene-msc commented 4 years ago

I am trying to use HIE with Neovim and Coc. I configured everything as in documentation, but I get no diagnostics.

ghc is 8.8.3 and I built HIE from sources with stack The system is Ubuntu 19.10

In :CocInfo I see that it crashes with error

2020-05-04 12:45:53.259897418 [ThreadId 9] - Scheduler thread exited unexpectedly: user error (Pattern match failure in do expression at lib/Distribution/Helper.hs:603:7-22)

And when I try to run hie-wrapper in shell I get the same error

2020-05-04 12:44:12.545691526 [ThreadId 4] - New cradle: /home/yeti/projects/haskell/helloworld/Hello.hs
2020-05-04 12:44:12.546935854 [ThreadId 4] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/home/yeti/projects/haskell/helloworld/stack.yaml"}
2020-05-04 12:44:12.547059432 [ThreadId 4] - Module "/home/yeti/projects/haskell/helloworld/Hello.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/yeti/projects/haskell/helloworld", cradleOptsProg = CradleAction: Other Stack}
2020-05-04 12:44:12.547137868 [ThreadId 4] - Found cradle: Cradle {cradleRootDir = "/home/yeti/projects/haskell/helloworld", cradleOptsProg = CradleAction: Other Stack}
hie-8.8.3: user error (Pattern match failure in do expression at lib/Distribution/Helper.hs:603:7-22)
hie-wrapper: callProcess: /home/yeti/.local/bin/hie-8.8.3 (exit 1): failed
fendor commented 4 years ago

As a work-around, you can write a custom hie.yaml in the root of your project with the contents:

cradle:
  stack:

For an explanation of this hie.yaml, see https://github.com/mpickering/hie-bios/ And an example for a more complex one: https://github.com/haskell/haskell-ide-engine/blob/master/hie.yaml.stack Some other examples, https://github.com/haskell/haskell-ide-engine#project-configuration

@jneira Iirc, you fixed that bug in cabal-helper?

Eugene-msc commented 4 years ago

@fendor Thanks, it worked! Now hie does not crash and I'm getting errors highlighted. Not autocomplete though

Eugene-msc commented 4 years ago

@fendor I think lack of autocomplete was a problem of my project itself. I deleted unneeded files restarted Coc and it started working. Everything works now. Thank you very much!

fendor commented 4 years ago

Happy to help!

We'll keep this open, until the issue is fixed!

jneira commented 4 years ago

Issue upstream: https://github.com/DanielG/cabal-helper/issues/90 It seems it is caused by stack not returning any .cabal files

jneira commented 4 years ago

Closing in favor of #1666