-
-
Notifications
You must be signed in to change notification settings - Fork 37
Description
I’ve really enjoyed exploring Gleam—what a fantastic ecosystem! This extension has been incredibly useful, but I’ve encountered a small issue detailed below. If there’s any way I can assist with resolving this or if I’ve duplicated an existing issue, please let me know.
Description
It appears that a cached path setting prevents VSCode from recognizing the updated path of the Gleam executable when using Nix Flakes. Each time a new Nix development shell is instantiated in a separate directory (for a new project), the path to the Gleam executable changes, leading to detection issues in VSCode.
Error Message
When this issue occurs, the following error message is shown:
[Error - 10:02:36 PM] Gleam Language Server client: couldn't create connection to server.
Launching server using command gleam failed. Error: spawn gleam ENOENT
Reproduction Steps
- Use a flake.nix setup similar to the example below.
- Open a new project in a separate directory and initiate a development shell.
- Observe the error in VSCode indicating that the Gleam executable path is not found.
Example flake.nix File
{
inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; };
outputs = { self, nixpkgs }:
let
systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSystem = nixpkgs.lib.genAttrs systems;
in {
devShells = forEachSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in {
default = pkgs.mkShell {
buildInputs = [ pkgs.gleam pkgs.erlang pkgs.rebar3 ];
};
});
};
}
Current Workarounds
1. Disable and Re-enable the Gleam Extension in VSCode
Disabling and re-enabling the Gleam extension temporarily resolves the issue, allowing VSCode to recognize the current executable path.
2. Define All Gleam Projects Under a Shared Parent Directory
Placing all Gleam projects under a single parent directory with a shared flake.nix file resolves the path issue. However, this approach limits the flexibility of using flake.nix for unique, project-specific environments.
Environment Details
- Local Machine: MacOS Sequioa
- Development Environment: VSCode Remote SSH Development connected to a NixOS server (LTS)
- Shell Setup: Using the above flake.nix configuration for each project
- Shell Setup:
direnvexecutable loads a.envrcfile with the contentsuse flakeon opening project orcding into a directory - VSCode: Extension for Direnv to load the shell into the editor context (for LSP support inside the direnv shell context)
- VSCode: Extension for Nix Environment Selector (Somewhat redundant with the Direnv extension)
Expected Behavior
The Gleam executable path should be dynamically detected for each project?
Additional Context
Any guidance on resolving this path-caching issue would be greatly appreciated, as the current setup is needed for maintaining isolated development environments for each project.