arrterian / nix-env-selector

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

activate on onLanguage event #82

Closed hagl closed 1 year ago

hagl commented 1 year ago
Status Type Config Change
Ready Bug No

Problem

https://github.com/arrterian/nix-env-selector/issues/80

With the March 2023 release of VS Code the nix-env-selector extension seems to be activated too late, causing other extension that depend on the loaded nix environment to fail. For example we install the haskell-language-server for the ghc version used in a project via nix, but the haskell language extension can't find it after instantiating the nix environment and reloading the window.

Solution

Adding an additional activationEvent "onLanguage" in the extension manifest seems to activate the extension earlier and solves the issue (at least for the haskell extension).

This is the same approach that the direnv-vscode extension is using, see: https://github.com/direnv/direnv-vscode/pull/463

arrterian commented 1 year ago

@hagl Thanks for your contribution.