emeraldwalk / vscode-runonsave

Visual Studio Code extension to run commands whenever a file is saved.
Apache License 2.0
182 stars 57 forks source link

Option to Inherit VSCode Window Environment #108

Open CS-Account opened 1 month ago

CS-Account commented 1 month ago

Is your feature request related to a problem? Please describe. I would like to run a script upon each save with the environment that VSCode has already inherited. This would enable a user to run any command they would manually run in the terminal without having to figure out the specifics of setting up the environment with every run.

Describe the solution you'd like I imagine that something like the VSCode API Terminal class could help achieve this with the strictEnv?: boolean terminal option being of interest in particular, enabling the user to choose whether to inherit from the window's environment or create an environment solely from the env option.

Additional context I believe this may also solve issues such as #106 and #62

Implementation from the viewpoint of the config might look like the addition of a boolean configuration option to enable or disable strictEnv, enabling by default as to not modify the behavior of the extension for existing configurations and users.

bmingles commented 1 month ago

@CS-Account I’ve considered using terminal apis as well, but I think it will need to be implemented as an opt in feature to avoid breaking existing users. Namely some users may not want an additional terminal to show up. Also makes me a bit nervous that it may behave differently depending on the backing shell, specific commands, etc. vs the node child_process exec apis currently used.

That said, I do like the idea of having it as an option. I just mention this as part of requirements in case you were inclined to submit a PR