emacs-lsp/lsp-haskell

"member of the hidden package" error

DamienCassou opened this issue · 2 comments

Hi,

⚠️ I'm learning haskell and have barely any experience with LSP.

I created a new project with stack new. I also added tasty and tasty-hspec to my package.yaml:

tests:
  hyahtzee2-test:
    main:                Spec.hs
    source-dirs:         test
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - hyahtzee2
    - tasty
    - tasty-hspec

This seems to have worked fine because my hyahtzee2.cabal got updated with references to the 2 tasty dependencies. Moreover, stack test runs my tests successfully.

Nevertheless, lsp complains while checking my test/Spec.hs file:

import qualified Test.Tasty as Tasty
import           Test.Tasty.Hspec (shouldBe, describe, it, testSpec)

The error message is:

LSP :: Connected to [lsp-haskell:191742 status:starting].
LSP :: lsp-haskell:191742 initialized successfully
Could not load module ‘Test.Tasty’
It is a member of the hidden package ‘tasty-1.2.3’.
You can run ‘:set -package tasty’ to expose it.
(Note: this unloads all the modules in the current scope.)

Thanks for the report, but this is a server issue, so please reopen it in haskell-language-server.

Thank you for the idea. I solved my issue by updating haskell-language-server.