Skip to content
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

Configurable terminal environment activation #24759

Open
anthonykim1 opened this issue Jan 29, 2025 · 0 comments
Open

Configurable terminal environment activation #24759

anthonykim1 opened this issue Jan 29, 2025 · 0 comments
Assignees
Labels
area-terminal feature-request Request for new features or functionality needs proposal Need to make some design decisions

Comments

@anthonykim1
Copy link

anthonykim1 commented Jan 29, 2025

Instead of simply removing the existence of terminal env var activation: #24567

In replace of the terminal env var activation experiment, we could build an experience where we can have a proper "hidden/clean" activation without explicitly activating (via manually setting user's environment variables and this is where we had difficult time being confident of whether user's environment was properly activated or not).

Note: Clean/hidden activation represents an virtual environment activation where user would not see the environment+shell specific activate command/scripts run in their terminal visible UI-wise.

To give a gist of the discussion with @karthiknadig :

In the VS Code side (Typescript side) - meaning the Python environment extension side of things, we could set an activation environment variable flag for specific shell (so something like VSCODE_BASH_ACTIVATE) and have it point to the environment specific activation script source ../..etc.

Then add this environment variable via environment variable collection API (already exists in core) => meaning add this environment variable to terminal process when we create terminal.

On the shell script side of things (meaning shell init script such as .zshrc or .bashrc), we would check if the user specifically wanted this "hidden/clean" activation setting.
IF SO we would simply run the "source ./venv/ ..etc" inside the shell init script.

In running "source ...etc" activation command on behalf of user, they will not see this activation command on their terminal and we would not have to worry if their environment is fully activated (via implicitly setting environment variable in the terminal env var experiment case).
But rest ensured their environment will be activated via the existence and execution of "source ..etc" activation command injected into user's shell init script.

Also note that running source activation command automatically will add deactivate script into user's directory so we do not have to worry about setting deactivate script manually.

We would also be able to check the activation state of user via shell environment API: microsoft/vscode#227467

@anthonykim1 anthonykim1 added area-terminal feature-request Request for new features or functionality needs proposal Need to make some design decisions labels Jan 29, 2025
@anthonykim1 anthonykim1 self-assigned this Jan 29, 2025
@karthiknadig karthiknadig changed the title Configurable hidden terminal environment activation Configurable terminal environment activation Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-terminal feature-request Request for new features or functionality needs proposal Need to make some design decisions
Projects
None yet
Development

No branches or pull requests

1 participant