-
-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cant load exe/test/bench module wit stack if the library has not been built previously #318
Comments
I am sorry, the link does not point anywhere, could you correct the link? |
@fendor Sorry, didn't realize that org creates private repos by default. Changed it to public now - could you try again? |
Edit: I misunderstood the context so my comment does not apply, please ignore this. |
With cabal, everything works fine for me. (except for hspec-discover not being on my path) > stack repl niancat:exe:niancat-exe
Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
Using main module: 1. Package `niancat' component niancat:exe:niancat-exe with main-is file: /home/munin/Documents/haskell/niancat-haskell/src/app/Main.hs
Building all executables for `niancat' once. After a successful build of all of them, only specified executables will be rebuilt.
niancat> configure (lib + exe)
Configuring niancat-0.1.0.0...
niancat> initial-build-steps (lib + exe)
The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
Configuring GHCi with the following packages: niancat
GHCi, version 8.8.3: https://www.haskell.org/ghc/ :? for help
<command line>: cannot satisfy -package niancat-0.1.0.0
(use -v for more information) can you confirm this behaviour? If yes, I suggest that this is a stack bug. |
@fendor Yes, I see the same thing:
How/where do I report this to Stack, if it is indeed a Stack bug? And what do you think is the minimal stuff needed to reproduce this, if I want to put together a minimal reproduction first (I don't think I understand the issue well enough yet to do that...)? |
Report at their main repo: https://github.com/commercialhaskell/stack/issues About minimal, I would not worry for now. Just post the issue with the example project. |
Interestingly, that did not reproduce... 🤔 Here's the repo where I'll build a repro: https://github.com/tomasaschan/repro-haskell-stack-multiproj. If you have any idea what difference between the two could be responsible, I'm all ears. It's bed-time where I am now, but I'll keep looking into this to see if I can narrow it down. |
After doing some more digging on this, I've found that this seems to reproduce only if the latest attempts at building the project failed. After a successful build, it works again - and keeps working even if I break things. I suspect the problem is that the project has to be in a building state when the language server starts; if not, it fails to start the REPL and doesn't retry. If I restart the HLS process (through the command palette) when the project is in a good state again, it starts working. Thus, I don't think this is a Stack bug - but I don't know what the best fix would be, but I think it would be very helpful to at least displaying a message that says "The language server failed to initialize, because your project doesn't compile. Please fix the build errors and then restart the language server." |
It still is a stack bug if the |
* Fix source spans for multi-clause definitions Currently, we use the source span of the match which corresponds to the whole clause instead of just the function identifier. This resulted in us pointing every goto definition request within a clause to the function if there is no other information (either because it failed because it came from an external package or simply because you are not on an identifier). This PR fixes this by getting the proper source spans frmo the HsMatchContext. Somewhat annoyingly, we have to get it from the parsed module since GHC messes this up during typechecking but it’s reasonably simple.
@tomasaschan as mentioned in the last comment, although you observe the efect in the ide, the root cause is |
I think the root issue in stack could be: commercialhaskell/stack#4616 |
I think the root cause is the same as #366, with the same error |
I have a project that initializes fine with this extension, but it doesn't seem like I've gotten all the config right yet.
https://github.com/dandeliondeathray/niancat-haskell
When opening
src/app/Main.hs
I get squigglies aboutniancat-0.1.0.0
(my library package), and if I open a test file I get squigglies abouthspec
(referenced in the test package only, not the library).It seems like the GHCi instance used for tooltips etc is initialized with only the library, and not tests and exe parts, loaded, despite the existence of a
hie.yaml
which points to the root directories of the different parts.What am I doing wrong?
The text was updated successfully, but these errors were encountered: