-
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
usage in a nix project? #78
Comments
Hmm, as long as VSCode can interact with the process via stdin/stdout, it should technically work 🤔 |
I think you should ask this in the nix support zone, I am sure there are some people using it, but have no idea how. |
Any luck with this? |
I'm late to the party... but @o1lo01ol1o you probably want to just use nix environment selector. It's a bit more manual than say the direnv plugin+ lorri but it always works. Also until vscode supports plugin ordering microsoft/vscode#57481 (which they seem to have no interest in) any automated direnv usage will only ever work by chance since direnv needs to modify the load paths/env vars of other plugins before they start. Related: microsoft/vscode#13292 |
I get stuck whenever I want to save the file with Here is my log:
|
The state-of-the-art in nix usage of the haskell-language-server is in this issue: haskell/haskell-language-server#122 |
@jneira The issue you mentioned seems to be about HLS installation, while this issue is about integration of HLS from Nix shell into VS Code. |
If you want to use this extension with nix, choose to manage your HLS installation manually by setting |
Yes this is the hack I use. I know three options:
I see two options to improve this situation:
|
This is a VSCode feature, create in your project root {
"haskell.serverExecutablePath": "<hls-binary>"
} |
Hard no for any code support specific to nix. PATH is generic enough. |
You right, this seems to be working. Would you consider adding this way into README? |
Suure, but I am also open to contributors to add the documentation they would like to see 😇 |
I struggled with this problem for several hours, until I realized that one can control the temporal order of the dependencies. The Haskell extension is loaded when the first .hs file is opened. In order for the extension to find the executables in the Nix environment (haskell-language-server-wrapper, ghc, cabal, etc.), the $PATH must already contain the paths to the Nix store. The $PATH is set when the Nix Environment Selector extension loads. Therefore, when opening a Workspace wait until this extension finishes loading and then open a .hs file. Hope this saves somebody time. For the sake of reproducibility, here is a minimal default.nix file: {pkgs ? import <nixpkgs> {}}: with pkgs;
let
myHaskell = haskellPackages.ghcWithPackages myHaskellPackages;
myHaskellPackages = packages: with packages; [
haskell-language-server
# put haskell packages here
];
in
mkShell {
buildInputs = [
myHaskell
cabal-install
ghcid
# put any other binaries we need here
];
} |
There are some notes in the documentation about using the hie wrappers to get support in nix projects, is this possible?
I've currently installed
hie-nix
into my project environment (I can run the hie sever from mynix-shell
) and I have the following wrappers in my vscode configuration.where
backend/hie.sh
is:But it looks like this doesn't work for
vscode-hie-server
can anyone advise?
The text was updated successfully, but these errors were encountered: