Closed jul1u5 closed 3 years ago
@jul1u5 Hi, thank you for the enhancement proposal. In the current feature request, I found a couple of reasonable ideas for the further evolution of the extension.
nixpkgs
by separate commandStaff that should be considered implemented another way
I think it's no so good idea to save a list of configured packages in .vscode
workspace setting file. The reason is duplication places where the packages can be listed. Will better to generate <config>.nix
file as output for the command if not exist yet and modify existed when the package list should be updated.
PS: Appreciate your feedback and welcome to the discussion 🙂
Hi, @arrterian, sorry for the delay.
I have given some thought to your idea of generating some <config>.nix
file instead of putting the list of packages in .vscode/settings.json
file. Single-source of truth seems more desirable. However, I have thought of some edge-cases:
Suppose a project already contains a shell.nix
file.
buildInputs
, buildNativeInputs
lists specified in the file. shell.nix
file and add the package to buildInputs
list by default. If there is no buildInputs
specified, the command could show a warning. However, implementing the parser for the Nix language would complicate the project a lot, wouldn't it?Just for reference when using, for example, nix-shell -p tree
the shell will ignore any .nix
files in the directory, and only load tree
together with the current user environment.
Maybe it wouldn't be that bad to put the package list in the .vscode
directory? The user could still see where the packages are loaded from when using Select Environment
command. If some file like shell.nix
is already selected (instead of an internal environment in .vscode
dir), the command for adding packages would refuse to add them and display a warning.
What are your thoughts?
@jul1u5 I think the way storing packages for nix-shell -p
in .vscode/settings.json
is most comfortable and fast to implement.
For now, I am rewriting the extension to Purescript. It reasonable to proceed with adding new features after the rewriting process will end.
That's cool. Let me know when you finish the rewrite. I can help with implementing this feature.
Added in #44 Released in v1.0.0 Please, read CHANGELOG.md for more info.
Is your feature request related to a problem? Please describe. Right now the quickest way of making VSCode aware of some packages you need to create a
shell.nix
file. This creates some friction when you want to check out some projects without creating new files.Describe the solution you'd like I propose a new command that would function similarly to
nix-shell -p
. The command would ask for the name of the package and then load it into the environment. Ideally, the command could display a list of packages from nixpkgs and filter it out as you type the name of the package.I am not sure what could be the best way to add multiple packages:
Describe alternatives you've considered An alternative is to use
nix-shell -p
in the terminal and then start VSCode from the same nix-shell.Additional context I think the specified packages could be saved in an array in
.vscode/settings.json
. Also, thanks for the extensions. It works really well.