Closed ghost closed 4 years ago
@koowashi Hi! I think this is a manifestation of #1564: try to build the project with stack build --test --no-run-tests
and reload the project to check if the error is gone.
I've just tested a similar configuration and it seems once that stack has built the project with stack build --test
the module is loaded succesfully even after a stack clean
.
stack needs to build the dependencies in the global cache (in the $(stack path --snapshot-install-root)
directory) and the error only is reproduced for me if i delete taht dir.
stack build --test --no-run-tests
succeeded, but VSCode errors are not gone.
stack test
is done correctly.
$ stack test
my-project> test (suite: my-project-test)
Prelude.head
returns the first element of a list
returns the first element of an *arbitrary* list
+++ OK, passed 100 tests.
throws an exception if used with an empty list
Finished in 0.0015 seconds
3 examples, 0 failures
I suspect my hie.yaml
is wrong.
If I change hie.yaml
like below, HIE can load Test.Hspec
(but not Test.QuickCheck
).
- path: "./test/"
- component: "my-project"
+ component: "hspec"
Your component looks wrong.
use stack ide targets
to find the components of your project. Should be something like `myproject:test:myproject-tests
cradle:
stack:
- path: "./app/"
component: "my-project:exe:my-project-exe"
- path: "./src/"
component: "my-project:lib"
- path: "./test/"
component: "my-project:test:my-project-test"
- path: "./Setup.hs"
component: "Cabal"
the errors have gone!
Environment
OS: Ubuntu 18.04.4 LTS (Bionic Beaver) hie: Version 1.1, Git revision c584f9821cf348907305706faf8b945899409811 (3811 commits) x86_64 ghc-8.6.5 stack: Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2 IDE: VS Code
VS Code Problems
Reproduce
$ stack new my-project
stack.yaml
's resolver toresolver: lts-14.0
test/Spec.hs
(from https://hspec.github.io/)package.yaml
hie.yaml