Andrej
Andrej

Reputation: 135

VS Code Haskell extension - Couldn't figure out what GHC version the project is using

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

Upvotes: 12

Views: 12218

Answers (2)

plasma
plasma

Reputation: 297

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

Upvotes: 5

Ari Fordsham
Ari Fordsham

Reputation: 2515

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!

Upvotes: 6

Related Questions