-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
graphical editor not detecting ghc/cabal/stack due to incomplete $PATH in the init config file #236
Comments
This is a bit of a silly question, but have you made sure that cabal/stack are on the PATH from VS Code? I.e. can you open up a terminal in VS Code and type |
Yes, both |
Hmm then perhaps that the PATH VS Code is launched with is different from whatever your shell is set as. Were you launching Code from a graphical shell? Is it able to find the binaries if you instead launch Code from your shell via |
This project: https://github.com/cronokirby/reg-viz/tree/679ed7e7f25b67d1fc96ef4bba11e7c3c759ede2 Exhibits this error as well, at least on my Linux (Manjaro) machine.
|
I get this as well, also on Arch Linux. I got my GHC and cabal from |
@gwils @cronokirby @dreamsmasher Can you try cloning this branch of the extension and running it locally, and see what the PATH error message says? https://github.com/haskell/vscode-haskell/tree/path-debug |
Sure thing, I’m out of town for a few days but I’ll update when I’m back. Thank you for the help so far. (also |
The
in bash/zsh I get
Note the extra entries on the front - they are added in my Edit: By the way, I tried |
I've found a better fix for this - rather than adding I suspect this fix will work for others on Arch Linux and its derivatives such as Manjaro. |
Maybe this is related to vscode-oss which is the official package on Arch. Path:
|
This is the solution. You could also use I'm not sure there's anything for HLS to do here, except maybe add this info to the README? Since it is admittedly easy to hit, and potentially frustrating. |
Having said that, actually, there may be reasons to not want to add Perhaps HLS should just provide the option to set the path to |
New release of HLS stopped the error from occurring anymore. Thank you to everyone who gave advice! |
Hey, I am on Manjaro/Arch Linux and just ran into this issue today. Not my first time trying to trick "haskell IDE stuff" into actually working, so I kept digging and finally ran into this issue. Newcomers might get discouraged by this easily, especially since "cabal and IDE story is fixed now". |
What changed? I'm not sure this is really resolved, as evidenced by @grizwako's issues. Another option we have would be, rather than polluting the README, to modify messages like Also, do we know if this is actually symptomatic of Arch (or possibly VScode OSS?)? What is e.g. Ubuntu doing differently? |
Actually, seeing as everyone here seems to have come from @hasufell Is there any reason not to do this? (To précis the above, certain editors will read only |
Come to think of it, I believe this is what |
Clarification: ghcup doesn't do that (and never will). The bootstrap script does that (the thing that runs when you do the curl command).
The bootstrap script tries to not guess too much and keep editing user files to an absolute minimum. This can always go wrong, even if you print 20 warnings to the user. They'll just press enter and then something is messed up, because we couldn't anticipate every possible configuration. That said, However, I don't know exactly what VSCode is doing here anyway. We don't want to edit files "just in case". |
Apologies - that is indeed what I meant.
Ah, I hadn't realised that bash only reads |
Note that haskell/ghcide#577 is essentially the same issue as this. |
reopen, as it would need at least some documentation (change ghcup would be an option?) |
That said, i am not against a config option to set ghcup as it could be useful in its own, so pr's would be welcomed. |
/etc/profile
/etc/profile
This affects all graphical editors as it is directly caused on how linux windows managers handle the user environment. |
/etc/profile
/etc/profile
/etc/profile
This seems to be a common issue bewteen vscode and other graphical editors unsing the lsp protocol. |
Hi, the last version of the vscode 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" }
} @georgefst would that also work as an acceptable workaround? I think this is essentially a issue in the interacion between the editor and the linux/macos window manager and we can only provide workarounds like the mentioned one. |
Yes, that's one solution. At the very least, I think HLS should prompt the user toward filling in that setting, whenever it fails to find GHC. |
This isn't making any difference for me on a new M1 Mac. And unfortunately, neither are any of the other suggestions in this thread. I always get "Project requires GHC but it isn't installed". EDIT: at some point this just started working, and I can't work out what changed. |
I'm on void linux and tried adding that PATH snippet, but I also get "Project requires GHC but it isn't installed". I tried adding the path of the language server in the "Haskell: Server Executable Path" setting, and the "GHC isn't installed" warning goes away, but still doesn't work. |
Having the exact same problem as @bakuhatu |
haskell/vscode-haskell#547 will fix this in the following way:
|
That solved it for me. So does that mean vscode doesn't use the user env by default? |
Putting this in settings.json as suggested by @hasufell worked for me: "haskell.serverEnvironment": { "PATH": "${HOME}/.ghcup/bin:${PATH}" } Thank you for adding this setting! I'm also on Arch Linux with Xfce and VSCodium, installed from the curl script. |
Tentatively closing since it seems there's an appropriate setting for this in the extension now |
We could add some logic in HLS, so it searches for a ghcup binary via:
And then possibly ask the user if they want to augment their PATH via vscode settings. |
I do think this is a client (extension) issue though. I think HLS itself should just expect to be launched with the correct PATH set. |
Yes |
I'm having some issues with getting the extension to work right - currently, my Cabal installation is from ghcup, and Stack is built from Cabal (GHC 8.8.3). When loading projects in VSCode, I keep getting the error
Project requires Cabal but it isn't installed
. Stack projects give me the same error but with Stack, and the installation link just takes me to the ghcup page.I've tried downloading the binary from the releases page and manually adding it to my configuration, as well as building it from source. No luck whatsoever, and using ghcide with the haskell-language-server-wrapper doesn't work either.
System: Arch Linux, i5-7600k, 16GB RAM, GHC 8.8.3
hie.yaml:
settings.json:
Any help would be appreciated, I'm currently doing fine with ALE/neovim but I'd like to be able to use an IDE for larger projects. Thanks!
The text was updated successfully, but these errors were encountered: