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

Viewed 4212

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
2 Answers

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!

Related