-
Notifications
You must be signed in to change notification settings - Fork 90
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
Error popup - Project requires GHC but it isn't installed using zsh as default shell #492
Comments
I have the same problem on Arch, although I'm not sure it happens for the same reason I installed GHC with ghcup, and I'm adding it to my path both in my zshrc config and fish config, but the extension still tells me it can't find ghc :( |
it works if you open vscode from the shell? |
Yes, but it would be good to have a solution rather than a workaround :( |
no problem, so it seems some init file needs to be changed to make the windows manager see the ghcup env. I am not a linux expert but maybe etc/profile? see haskell/haskell-language-server#236 |
I tried modifying |
Ok, master version of the extension has lot of more traces, amongs them all environment variables including the PATH. |
It's true that it doesn't seem to be on the path, but I don't understand why :(
|
Yeah, We have to investigate how to make vscode aware of your shell environment 🤔 |
Well, I had forgotten about it, but now I think when I installed the Rust extension (it was some time ago), it told me the same and I grew tired of it and just clicked install. Maybe I have rust installed twice (?), how could I check that? |
Well i think the rust extension downloads rustup, which afaik is the equivalent of ghcup and then uses it to get all the needed tooling so maybe you dont have it twice. I've search a little bit and i've read https://stackoverflow.com/questions/43983718/set-global-path-environment-variable-in-vs-code There is an answer talking about |
That really worked! Thanks so much. It seems vscode doesn't run the shell interactively, so it wouldn't even bother with the |
@KristianBalaj hi, maybe the same trick could help you? |
Setting The pop up is still showing up. |
hmm being a different os could be related 🤔 |
what about changing |
@jneira I haven't touched the .zshrc yet, what should I change in there? |
sourcing |
Hi, the last version of the extension just released lets you set a specific environment for the lsp server wrapper, so you can set a specific { "haskell.serverEnvironment":
{ "PATH": "/path/to/hls:/path/to/ghc:/path/to/cabal" }
} I think this is essentially a issue in the interacion between vscode and the linux/macos window manager and we can only provide workarounds like the mentioned one, so i am gonna close this. Feel free to reopen if you think otherwise. |
Hmm, I was using it the way that I always closed VSCode and then open it with a project but it is annoying so I tried to set the I've set this in settings.json: "haskell.serverEnvironment": {
"PATH": "/Users/kristian/.ghcup/bin/ghc:/Users/kristian/.ghcup/bin/cabal"
} It still shows the error popup Other notesI don't know what path to hls to add there, since I don't have hls on PATH (hls --help fails in cmd) - installed with ghcup. I have ghc and and cabal on my path. |
@jneira hi, I haven't heard from you for a long time since I've posted a comment after the issue was closed. |
Agh, just got back to this and solved it the following way according to this posted previously in this issue: echo "export PATH=$PATH" >> ~/.zshenv After this, the error popup with the missing GHC does not show anymore and the VS Code extension works like expected 🙌 Probably the same could be achieved by setting the PATH here to the value of { "haskell.serverEnvironment":
{ "PATH": "" }
} |
sorry, i missed your response, the path should point to the directory containing the binaries and not the binary itself so
maybe will make it work |
nice! |
This will break at least on the upcoming changes, where we expect |
The error notification pops even though the GHC is installed and available on the PATH along with the Cabal.
I've found out it is happening only when I'm opening a project directory using a MacOS quick action configured as following https://www.jimbobbennett.io/open-anything-in-vs-code-using-a-macos-quick-action/
This error pops only when the VS Code is already running in the background (there is the dot under the VS Code icon in the Dock). In case it is a clean start of the VS Code it is not happening.
I'm using the
/bin/zsh
shell by default where the GHC is on the PATH and also I've setup the Quick action to run in the/bin/zsh
(in the tutorial from the link above the Quick action is run in the/bin/bash
).VS Code output on error notification on startup
VS Code output when the project is started successfully
ghcup tui
The text was updated successfully, but these errors were encountered: