haskell / haskell-ide-engine

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

Hie-wrapper dead while start-up: no .cabal files in stack based project #1666

Open Hypnoes opened 4 years ago

Hypnoes commented 4 years ago

Here is the output from log:

2020-02-25 15:50:24.185400354 [ThreadId 4] - run entered for hie-wrapper(hie-wrapper) Version 1.1, Git revision 91422e95459130633905ab619772150860b2da2d (3793 commits) x86_64 ghc-8.8.2
2020-02-25 15:50:24.185751944 [ThreadId 4] - Current directory:/home/hypnoes/source/repos/devoke
2020-02-25 15:50:24.185931317 [ThreadId 4] - Operating system:linux
2020-02-25 15:50:24.18598141 [ThreadId 4] - args:["--lsp"]
2020-02-25 15:50:24.186935326 [ThreadId 4] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/home/hypnoes/source/repos/devoke/stack.yaml"}
Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
hie-wrapper: user error (Pattern match failure in do expression at lib/Distribution/Helper.hs:603:7-22)
[Error - 3:50:24 PM] Connection to server got closed. Server will not be restarted.

I thought it might be related to DanielG/cabal-helper/issues/90, but i can't find the solution of this problem.

fendor commented 4 years ago

A possible solution might be to add an explicit hie.yaml with the contents:

cradle:
  stack:

for simple projects and for more complex projects, use a more complex one, see https://github.com/haskell/haskell-ide-engine#project-configuration You can find the components of your projects via stack ide targets and components are your executables, library, tests and benchmarks.

DanielG commented 4 years ago

@Hypnoes Can you paste the output of stack ide packages --cabal-files --stdout and just stack ide packages --stdout?

Hypnoes commented 4 years ago

@Hypnoes Can you paste the output of stack ide packages --cabal-files --stdout and just stack ide packages --stdout?

Nothing.

Btw, add a hie.yaml just work for me. But why? why it work?

DanielG commented 4 years ago

Ok, so how is your project setup? Do you have a stack.yaml, package.yaml, *.cabal file or all of the above?

If stack build works in your project but ide packages doesn't spit anything out I'd actually consider this a stack bug.

Hypnoes commented 4 years ago

@DanielG Emmm, I just found stack build goes wrong. I build a new project by stack new and it works. So it seems i'm not config my project correctly.

awgn commented 4 years ago

I'm facing the same issue here. Instead, with the following hie.yaml:

cradle:
   stack:

it does work.

Stack build builds properly the project and stack ide packages dumps the package name.

The interesting part is that the project is using a handwritten cabal file, though it does compile via stack (hence it is equipped with both stack.yml and the related project.cabal).

The resolver in use is lts-15.1, and the build-type: Simple is set.

jneira commented 4 years ago

@awgn and stack ide packages --cabal-files --stdout?

fendor commented 4 years ago

@awgn Please post some logs, if you use hie.yaml, your problem is definitely different to the posted issue. Ideally, open a new issue with logs attached, please :)

jneira commented 4 years ago

To be sure that it is the same issue the error log should contain: user error (Pattern match failure in do expression at lib/Distribution/Helper.hs:603:7-22) (with the exact line numbers)

ryanbas21 commented 4 years ago

If it helps, I am running arch and installed via aura -A haskell-ide-engine.

I had the exact error @jneira posted above. I added the hie.yaml as also posted above.

resulted in

2020-03-20 21:11:32.758869325 [ThreadId 4] - Executing Stack GHC with args: --numeric-version
2020-03-20 21:11:33.00966254 [ThreadId 4] - Project GHC version:8.8.3
2020-03-20 21:11:33.00973858 [ThreadId 4] - hie exe candidates :["hie-8.8.3","hie-8.8","hie"]
2020-03-20 21:11:33.009944699 [ThreadId 4] - cannot find any hie exe, looked for:hie-8.8.3, hie-8.8, hie
[Error  - 9:11:33 PM] Connection to server got closed. Server will not be restarted.

The project I am in was initialized via stack new on Version 2.2.0, Git revision 95aaf2bc2c969622679c2a8233e7bb637e43210d (dirty) (8043 commits) PRE-RELEASE x86_64

stack ide packages --cabal-files --stdout produced no output.

I solved this by uninstalling haskell-ide-engine with aura and cloning the repo manually.