haskell-servant / servant

Servat is a Haskell DSL for describing, serving, querying, mocking, documenting web applications and more!
https://docs.servant.dev/
1.83k stars 413 forks source link

tutorial stack template is crashing lsp server in emacs #1559

Closed YievCkim closed 2 years ago

YievCkim commented 2 years ago

Hi,

I tried to do the tutorial here https://docs.servant.dev/en/stable/tutorial/ApiType.html#

When I create a new project with stack:

$ stack new test-servant servant

I get this layout:

test-servant
├── LICENSE
├── README.md
├── Setup.hs
├── app
│   └── Main.hs
├── package.yaml
├── src
│   └── Lib.hs
├── stack.yaml
├── stack.yaml.lock
├── test
│   └── Spec.hs
└── test-servant.cabal

If I try to open Lib.hs with emacs. The LSP server crash immediately with this error :

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 x86_64 ghc-8.10.7
Current directory: /Users/moi/Dev/Haskell/test-servant
Operating system: darwin
Arguments: ["--lsp","-d","-l","/var/folders/2k/p5hpgh1j4k55pxn46_msslsm0000gn/T/hls.log"]
Cradle directory: /Users/moi/Dev/Haskell/test-servant
Cradle type: Stack

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

Consulting the cradle to get project GHC version...
Failed to get project GHC version:CradleError {cradleErrorDependencies = [], cradleErrorExitCode = ExitFailure 1, cradleErrorStderr = ["Error when calling stack setup --silent","",""]}

I don't know if this issue is related to the template or haskell lsp server.

byorgey commented 2 years ago

Possibly related? https://github.com/haskell/haskell-language-server/issues/2224 Try removing .ghc/blahblah/environments/default . That has worked for me in the past when I've encountered similar issues.

YievCkim commented 2 years ago

Thank you indeed it works. I don't know why. But it works.