10

When I open some haskell project in VS Code I get this message:

Couldn't figure out what GHC version the project is using: /home/andrej/.config/Code - OSS/User/globalStorage/haskell.haskell/haskell-language-server-wrapper-1.2.0-linux --project-ghc-version exited with exit code 1: No 'hie.yaml' found. Try to discover the project type! Failed get project GHC version, since we have a none cradle

How to solve it?

Edit:

Here is tree structure of the project:

.
├── .exercism
│   └── metadata.json
├── package.yaml
├── README.md
├── src
│   └── ResistorColors.hs
├── stack.yaml
└── test
    └── Tests.hs
Gama11
  • 31,714
  • 9
  • 78
  • 100
Andrej
  • 113
  • 3
  • 8
  • Seems like you need to create that `hie.yaml`. – sjakobi Jun 24 '21 at 15:03
  • hi, could you share the output of calling `/path/to/haskell-language-server-wrapper-1.2.0-linux --probe-tools` and the same command with `--project-ghc-version` in a shell with the current working dir in the project root dir? – jneira Jun 24 '21 at 17:22
  • https://github.com/Avi-D-coder/implicit-hie#readme You can use this tool to generate an `hie.yaml` file. – DrSooch Jun 24 '21 at 20:06
  • when i run `stack build` and then restart vs code, error no longer appears – Andrej Jun 24 '21 at 21:21

2 Answers2

6

Since your project has stack project config files, The Haskell extension should be able to figure out what it needs and a hie.yaml file to configure the extension is typically not needed for simple projects like this.

haskell-language-server, the project upon which the VS Code Haskell exension is based, is still under active development and often gets a bit stuck. The folllowing can help sort a lot of common issues:

  1. Run
    stack clean
    stack build
    
  2. Press Ctrl+Shift+P and click 'Haskell: Restart Haskell LSP Server' (start typing to find it).

Happy Haskelling!

Ari Fordsham
  • 2,437
  • 7
  • 28
4

None of them working, until I delete /Users/sweirich/.ghc/x86_64-darwin-8.10.4/environments/default

Once you delete the default, and reopen the vs code. VS Haskell extension will reset the setting, and the error seems to go away.

Found the answer at https://issueexplorer.com/issue/haskell/haskell-language-server/2224

plasma
  • 287
  • 3
  • 12
  • Also worked when I had similar issue to this: https://github.com/haskell/haskell-language-server/issues/2495 - seems deleting `default` can "fix" a bunch of seemingly unrelated issues. – Heath Raftery Jan 09 '22 at 13:47