arrterian / nix-env-selector

Allows switch environment for Visual Studio Code using Nix Package Manager.
MIT License
220 stars 29 forks source link

Can find packages from nix-shell, but not with nix-env-selector #80

Open makeller1 opened 1 year ago

makeller1 commented 1 year ago

When I run nix-shell and then code ., intellisense can find all of my packages. However, opening VS Code (not from the nix-shell) using nix-env-selector, intellisense does not find the packages. I've uninstalled, reinstalled, and repeated selection of the environment.

Environment:

georgefst commented 1 year ago

Yep, I've found this since the latest VSCode update (March 2023). In my case, it's the Haskell extension crashing at launch because it can't find the language server binary. So it looks like upstream may have completely broken this extension...

georgefst commented 1 year ago

Between this and #53*, I've ended up switching to using direnv (with nix-direnv). All I needed to do to replicate nix-env-selector was to install direnv and the maintained direnv VSCode extension and add a .envrc to each project with:

if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
  source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
fi

use flake

then run direnv allow . once from each project directory.

I did prefer the seamless experience of nix-env-selector when it worked though!

* EDIT: And, perhaps, a general lagginess since the last VSCode update, particularly in Go To Next Change? I had assumed this was unrelated, but it also seems to have gone away since the switch...

hagl commented 1 year ago

For the haskell-language-server I could get it working again by adding an additional "onLanguage" activationEvent in the extension manifest. See #82