1

System Info: Ubuntu :20.04

I am trying to get VSCode HLS extension working for plutus based project but seeing below error in output.

Failed to get project GHC version: no cradle
[Info  - 3:27:24 p.m.] Connection to server got closed. Server will restart.
No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.7.0.0 x86_64 ghc-9.2.2
Current directory: /home/skb/dev/emurgoProject
Operating system: linux
Arguments: ["--lsp"]
Cradle directory: /home/skb/dev/emurgoProject
Cradle type: Stack

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

I have nix shell evnironment via this repo: https://github.com/input-output-hk/plutus-apps 
Below is what am doing:
1. Run **nix-shell** from root folder of plutus-apps repo.
2. cd (change dir) to my plutus project folder which I created based on: https://github.com/input-output-hk/plutus-starter
3. code . to open the vscode

Side note: HLS work for non plutus projects in my machine (when I am not running nix-shell).

1 Answer 1

1

1 - Try running first the nix shell in a terminal then, from inside the nix shell, go to your project folder, and run: code .

Than will open you project with vcode and all the terminals and the HSL will be inside the nix shell you activated before.

Also, you will need the HLS installed inside the nix shell, for that, the best is to use ghcup inside the nix shell, to make sure all is needed is known for nix. For that run: ghcup install

You can see if there is any problem with HLS in the Output console in vcode, and in the list of outputs choose Haskell.

enter image description here'

That worked for me.

2 - For the cradle message, you can add a file in you root folder: hie.yaml and write this inside:

cradle:
  cabal:

3 -Im editing this with something also can work.

I was having problems with some errors and everything fixed when I deleted the cache file of hie-bios:

cd $HOME/.cache/
sudo rm -R  hie-bios

Check more solutions here:

https://haskell-language-server.readthedocs.io/en/latest/troubleshooting.html

4 - I found that haskell-server-language is installed already in the nix-shell of plutus-apps

Enter in the nix-shell and write:

> whereis haskell-language-server
> haskell-language-server: /nix/store/iy740dkx9anah9j04b4g3fnd7wjws3lm-haskell-language-server-exe-haskell-language-server-1.5.1.0/bin/haskell-language-server

Then in VCODE open you settings and put that into the serverExecutablePath field:

"haskell.serverExecutablePath": "/nix/store/iy740dkx9anah9j04b4g3fnd7wjws3lm-haskell-language-server-exe-haskell-language-server-1.5.1.0/bin/haskell-language-server"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.