emacs-lsp / lsp-haskell

lsp-mode :heart: haskell
https://emacs-lsp.github.io/lsp-haskell
GNU General Public License v3.0
227 stars 56 forks source link

"member of the hidden package" error #103

Closed DamienCassou closed 3 years ago

DamienCassou commented 3 years ago

Hi,

:warning: 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.)
michaelpj commented 3 years ago

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

DamienCassou commented 3 years ago

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