Search code examples
haskellvisual-studio-codehaskell-stack

VSCode no intellisense in haskell extension for additional modules


Is there a way to make intellisense work for additional modules (anything outside the prelude) like Quicktest or Random in VS Code? I am using:

  • VSCode: Version 1.55.0
  • the extension "Haskell v1.2.0" (with haskel-language-server)
  • ghci: GHCi, version 8.10.3: https://www.haskell.org/ghc/
  • stack: Version 2.5.1, Git revision d6ab861544918185236cf826cb2028abb266d6d5 x86_64 hpack-0.33.0
  • tried it direct on Windows10 and with WSL2 (Debian).

VSCode says:

Could not find module ‘Test.QuickCheck’
It is not a module in the current program, or in any known package.not found

enter image description here So, no autocomplete etc..

I think the reason is that I've installed Quicktest via stack, and that stack uses its own "isolated" ghc. So I looked for a way to configure the VSCode extension to use the ghc of my stack environment, without success.

I've also tingled with haddock and cabal, without success.

Does anybody using VS-Code to code haskell and have autocomplete, documentation on mouse over, wingman, ...?


Solution

  • Since I'm now revisiting haskell: The current VSCode Version 1.83.1 with the haskell extension Haskell 2.4.2. Autocomplete etc. are working fine.

    Go to project folder init stack and install a package:

    init stack
    stack install split
    

    Restart VScode for an implicit GHC restart. Afterwards everything works as expected see below:

    VSCode showing package doc