-
Notifications
You must be signed in to change notification settings - Fork 2
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
How to get VSCode to recognize a dependency #93
Comments
I somehow was able to find these instructions: https://www.reddit.com/r/haskellquestions/comments/mwi9pm/haskell_language_server_not_recognizing_imports/. Evidently, I need to install an executable from a package Oh, and what is HIE? It's becoming clearer this is really more appropriate on the HLS bug tracker. But I'll see if I get any comments here before replaying this there. In any case, I'm happily unstuck. |
I partied too soon. It turns out that the error is still here, but it just moved.... and became more inscrutable. I have
I'm now getting more lost, because I don't know what a |
Searching for "Multi Cradle: No prefixes matched" got me to haskell/haskell-language-server#1215, which is in the same area, but not exactly my problem. This bug report, though, links to https://github.com/haskell/haskell-language-server#configuring-your-project-build, which looks very promising. Sadly, the anchor doesn't exist anymore. :( It's not that hard to find my way to https://haskell-language-server.readthedocs.io/en/latest/configuration.html#configuring-your-project-build instead. This information is helpful, saying things like HLS will work out of the box "for most use cases". Good. Except it's not working for me, and I'm starting to doubt the claim, because my use-case seems really very simple. In any case, I'm linked to hie-bios for more information. So I follow the trail to https://github.com/haskell/hie-bios/blob/master/README.md This page tells me that my hie.yaml file should be just
This is different than what Now I get this error:
I'm intrigued by "The package patsyns4 has no file target 'VecUnsafe.hs'.". Given my decade of Haskell programming experience, I wonder if this means I need to add VecUnsafe (the file I'm trying to compile in VSCode) to my .cabal file. (Specifically, I happen to know that I should have This does not solve my problem. But, taking the very fine advice from This now gets me unstuck, I think. My VecUnsafe module is working. Now, though, I have errors in all my other modules, because they are not listed in my .cabal file. Urgh. I will add them. What's unfortunate is that I'm really at an early stage of tinkering here, and I don't know what modules I will want in the end. It's quite annoying having to update the .cabal file every time I restructure things. I remember the good old days, when I would take an error along the lines of |
Hi, thanks for describing your periplus. Like the other issue, lot of insights arise watching the process with new eyes.
I think the issue could be opened in hls, even if it ends to be a question and probably a documentation enhancement. You have experienced the issue through hls and i believe it should be the starting point to trace it.
Could you describe your actual workspace structure and config files (a link would be great)? |
I think the root causes of the perplexity are:
|
consider this shell session:
|
Caveats: |
I've added a change in docs to discourage the use of an |
@jneira So helpful! Thank you! Let me summarize the parts here that I found most helpful:
What's interesting is that I tested my understanding by creating a separate project that needed a package dependency. HLS failed to find the package (as expected). I then added a bare-bones .cabal file that included the right dependency. My experience last night suggested this wouldn't work. But -- with a restart of HLS and a little patience -- it did! So, maybe my critical error last night was not restarting HLS at precisely the right moment. Or maybe I made other mistakes. I'm now trying to come up with concrete suggestions of improvements to help the next person. Here are a few thoughts:
|
It would be good to explain the implicit discovery of the project type/tool.
I was reluctant to recommend it in docs cause i think we must fix all the root causes of having to restart the ide. But it is good for usersto know when they have to do it for sure. We have to update the troubleshooting section to reflect more recent issues.
mmm other users has hit the same issue. Not sure if set the downloaded executable in PATH would be the the best option though. Other one could be execute the downloaded hls in the project root, gather the info and automatically open an issue with all the known info in the hls repo, including os, tool versions and the the output.
Agree that would be the optimal solution, we have an old issue about haskell/haskell-language-server#155 |
That's fine if the algorithm changes -- but it should probably be stated somewhere, because things will go wrong sometimes. Equipped with the knowledge of the algorithm, I am then empowered to explore further and learn more about where things are going wrong.
For better or worse, I have discovered that I fairly often have to restart HLS -- basically, whenever I do something other than edit a Haskell file (e.g. add new files, rename files, delete files, edit dependencies, install new system packages, etc.). I agree it would be better not to have to do this, but I doubt it will never be necessary -- given that we all sometimes have to restart software created by very well-funded corporations.
I don't understand what you mean here, but allowing me to quickly open an issue sounds great. |
issue about opening an issue automatically: haskell/vscode-haskell#482 |
I have a Haskell file in VSCode with
import Data.Vector
. VSCode suggests to me that perhaps I wantData.Functor
. But, no, I wantData.Vector
.How can I get VSCode/HLS to recognize the
vector
package? I added a.cabal
file, but that doesn't seem to make a difference. I don't even know where to post this! Is it an HLS issue? A VSCode issue? A cabal issue? A GHC issue?Help?
The text was updated successfully, but these errors were encountered: