-
-
Notifications
You must be signed in to change notification settings - Fork 389
HLS can't find Main.hs for Haskell default project in VS Code, despite being listed in .cabal, and goes into crash loop #4034
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
Comments
Try adding the following
|
Did that, and the result is no different. Here's the end of the log:
Let me know if you need more from before this. |
Someone advised me that "template Haskell" is a separate thing, and certainly not what I'm working with! Reworded the title to be less misleading, I hope |
For what it's worth, in a fresh account on this laptop, a fresh install of VSCode, CHCup and HLS works ok. Still don't know why it's not working in my current account. Could there be some kind of system environment variable that's messing things up? |
In cases like this when things stop working mysteriously, I usually just delete hls's cache folder (where hls stores build artifacts). It's usually stored under home directory ~/.cache/ghcide - just rm -rf the whole directory |
Sadly, this didn't help. |
Sorry, I'm out of my depth :-/ |
And now, mysteriously, the problem seems to have fixed itself. I really don't know what happened there! |
I suggest closing this issue since the problem can't be reproduced any longer. It can be reopened, in case it reappears. |
@LucianU will do. |
No, it's not an issue that can't be reproduced. I ran into this issue with HLS2.9.0.1 + GHC9.10.1 + cabal3.10.3.0. For me, the problem was solved simply by copying the entire package folder into another directory. And after that, I found that the original path of my package contains a space in the parent folder just like: So the true cause of the error message @DavidMichaelRoberts may be that Hope this helps. |
The issue you describe is a cabal bug iirc haskell/cabal#8875 So that should be solved with |
@mozhewen excellent, this fixed the problem. The errors came back after apparently fixing themselves as I noted above, and this suggested helped --- there was indeed a folder in the path with a space in its name. |
Your environment
Mac OS 14.2.1 (23C71)
v9.4.8, pasting command from https://www.haskell.org/ghcup/
Unedited template Haskell project created via
cabal init --interactive
, the resulting.cabal
file is below, minus metadata.VS Code, pretty much a clean install
2.5.0.0, via VS Code
hie.yaml
file)?No
What's wrong?
I'm aware of #1297, but I'm not doing anything fancy at all.
Working with Cabal and a clean install of HLS and taking the template Haskell project, which does build, I'm getting the dreaded error
Despite
Main.hs
being listed in my.cabal
file, opening VS Code after successful compilation in the correct folder etc.HLS was working earlier in the week, and even after it broke on a larger project, it still worked on the template project, and then the next day HLS was broken on the template project too. I did not do any major upgrades that I am aware of. The larger project was pulled clean from GitHub, and my colleague also pulled a clean copy and had it work fine, before I tried to debug, and found that not even the template project resulting in HLS working properly.
See the attached log, but the HLS specifically breaks when it tries to find info on a type (or similar) to display as a tooltip in VSCode.
Debug information
Here's what I think is relevant from the log: HLS_log.txt
My
settings.json
from VS Code is (this is the complete file)The
.cabal
file of the project contains the following settings, after the project metadata (maintainer, license etc):Cabal version is 3.10.2.1, Stack (though I'm not using it) is v2.13.1, and GHCup is v0.1.20.0, and I have run
cabal update
.My PATH variable contains
/Users/david/.cabal/bin:/Users/david/.ghcup/bin
The text was updated successfully, but these errors were encountered: