haskell-ide-engine icon indicating copy to clipboard operation
haskell-ide-engine copied to clipboard

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

Open Hypnoes opened this issue 5 years ago • 10 comments
trafficstars

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.

Hypnoes avatar Feb 25 '20 09:02 Hypnoes

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.

fendor avatar Feb 25 '20 09:02 fendor

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

DanielG avatar Feb 25 '20 11:02 DanielG

@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?

Hypnoes avatar Feb 25 '20 13:02 Hypnoes

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.

DanielG avatar Feb 25 '20 13:02 DanielG

@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.

Hypnoes avatar Feb 25 '20 14:02 Hypnoes

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.

awgn avatar Mar 01 '20 07:03 awgn

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

jneira avatar Mar 01 '20 18:03 jneira

@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 :)

fendor avatar Mar 02 '20 10:03 fendor

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)

jneira avatar Mar 02 '20 12:03 jneira

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.

ryanbas21 avatar Mar 21 '20 03:03 ryanbas21