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

Poor Emacs lsp experience when cradle is wrong #102

Open
tomjaguarpaw opened this issue Dec 18, 2021 · 1 comment
Open

Poor Emacs lsp experience when cradle is wrong #102

tomjaguarpaw opened this issue Dec 18, 2021 · 1 comment
Labels

Comments

@tomjaguarpaw
Copy link
Owner

When the autodetected cradle is wrong haskell-language-server-wrapper errors out and Emacs displays an error in the mini-buffer:

Server lsp-haskell:993022/starting exited with status exit(check corresponding stderr buffer for details). Do you want to restart it? (y or n)

This is a terrible error message. It tells me absolutely nothing useful. It doesn't even tell me enough to know whether I want to restart it. If I choose y then it fails to start again. If I choose n then I am left in a Haskell source file without a language server.

I've no idea what "corresponding stderr buffer means" but I'm experienced enough with Emacs to try C-b. Sure enough there is a buffer there called *lsp-haskell::stderr*. It contains the below. For some reason the "cradle" has decided it wants stack despite by project being cabal. I have written up that issue: Avi-D-coder/implicit-hie-cradle#11

Suggestions:

  • Don't ask whether I want to restart the server without telling me some useful information with which I can make my decision. Presenting me with the information in the stderr buffer would be a good start!
  • If the cradle was incorrectly determined then give me an option, within Emacs, to let me choose to switch the cradle type. Also tell me how I can write a hie.yaml. I don't want to have to go chasing all around the internet for this information.
  • Fix the cradle detection

I don't know where this issue falls between HLS and Emacs lsp-mode.

No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.5.1.0, Git revision 745ef26f406dbdd5e4a538585f8519af9f1ccb09 (dirty) x86_64 ghc-8.10.7
Current directory: /home/tom/Haskell/remora
Operating system: linux
Arguments: ["--lsp","-d","-l","/tmp/hls.log"]
Cradle directory: /home/tom/Haskell/remora
Cradle type: Stack

Tool versions found on the $PATH
cabal:		3.6.2.0
stack:		Not found
ghc:		8.10.7


Consulting the cradle to get project GHC version...
Cradle requires stack but couldn't find it
Cradle {cradleRootDir = "/home/tom/Haskell/remora", cradleOptsProg = CradleAction: Stack}

Process lsp-haskell stderr finished
@jneira
Copy link

jneira commented Dec 18, 2021

I hope you dont mind if i comment in this repo (mainly about hls)

If the cradle was incorrectly determined then give me an option, within Emacs, to let me choose to switch the cradle type

There is a relevant issue in hls about: haskell/haskell-language-server#742

For some reason the "cradle" has decided it wants stack despite by project being cabal. I have written up that issue: Avi-D-coder/implicit-hie-cradle#11

We have to document the discover logic, log it and let users override it.
But we are not working a lot around of implicit-hie cause we are waiting for another alternative to the actual mechanism to interact with the build tools, more robust which needs support from the build tools. The automatic discovery process would probably we moved and maybe changed.

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

No branches or pull requests

2 participants