-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Gleam Executable Detection in VSCode with Nix Flakes #90
Comments
Hello! Nix produces a large support demand on Gleam core compared to other third party things, and it takes up more of our time than we can afford to spend on any one small subset of users when we could be working on things that benefit everyone, especially since the problems originate from Nix itself. Because of this we cannot do any Nix specific work. A PR would be accepted for small and easy to understand and maintain features that aid Nix folks, but ideally they would not be Nix specific. |
@lpil Totally understand and thank you for the context, nix is a unique environment and I don't want to add any burden to building out tooling for this wonderful language. I’ll fork the repo and try to dig deeper into this. I hope to identify whether the issue is rooted in changing file paths for the Gleam executable, something related to using the LSP integration with VSCode's Remote Development over SSH, or if it’s specifically tied to Nix’s behavior. Currently, I’m working around it by:
While it’s a bit tedious, it allows me to work on a single repo with a flake setup. The flake’s effect is updating the path of the executable, so my initial suspicion is that the issue might be related more broadly to changing paths and potential caching behavior rather than being exclusive to Nix development environments. Is it the expectation that the file path for the Gleam executable should remain consistent and not change? To test these theories I'm hoping to do the following (I'll try to remember to update this as I find out):
With this info I think we can determine if this is an issue with Nix and Nix Flakes, VSCode Remote Development or some behavior in the extension. I’ll keep investigating. Thanks again for your input and let me know if you think this isn't the correct way to go about this. |
No, you can change the executable location at any point and it will be used so long as it is on the PATH you have given to VSCode. This extension relies entirely on the operating system for executable discovery. If you want to change you path variable you will need to update any already-running processes with this new environment configuration, in this case VSCode.
You don't need to disable and re-enable the extension. It does not persist any state. |
@lpil Thanks for the helpful context. I believe the issue I’m encountering may not be directly related to Nix or Nix Flakes, but rather tied to VSCode Remote Development over SSH. I’ll continue investigating to better understand the root cause. The more specific behavior I’ve noticed is that if the connection with the language server is interrupted—such as when changing locations and closing my laptop—it seems to cause issues. I’ll dig deeper to see what might be happening in these scenarios. |
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:
Reproduction Steps
Example flake.nix File
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
direnv
executable loads a.envrc
file with the contentsuse flake
on opening project orcd
ing into a directoryExpected 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.
The text was updated successfully, but these errors were encountered: