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

Use shell integration to get environment variables #23159

Closed
anthonykim1 opened this issue Apr 1, 2024 · 8 comments
Closed

Use shell integration to get environment variables #23159

anthonykim1 opened this issue Apr 1, 2024 · 8 comments
Assignees
Labels
area-terminal feature-request Request for new features or functionality

Comments

@anthonykim1
Copy link

anthonykim1 commented Apr 1, 2024

Use shell integration to get environment variables and activate environment, instead of NodeJS process environment variables.

Python extension should be able to leverage: https://github.com/microsoft/vscode/blob/main/src/vscode-dts/vscode.proposed.terminalShellIntegration.d.ts and microsoft/vscode#207504 to get a full context of user's environment variables, especially those stored, modified in shell specific initialization scripts such as .zshrc, .bashrc.

Using hidden terminal which would have context of these initialization scripts, we can activate terminal environment with better context compared to the currently used process approach by enhancing shell integration hidden terminal approach.

This will resolve lot of issues where users are missing environment variables that are set inside their shell specific initialization script modified such as by conda activate if we know they have shell integration working/enabled for their terminal.

There will be additional issue/PR to resolve PS1 so users do not see unwanted PS1 if they are using specific prompt such from starship.

  • users using starship prompt are experiencing double (.venv) scenario as our current approach does not have context of user's shell initialization script.

There will be additional PR to use replacing option for environment variable instead of prepending option(this is known to shadow some of the important parts such as for PATH variable).

@anthonykim1 anthonykim1 added the feature-request Request for new features or functionality label Apr 1, 2024
@anthonykim1 anthonykim1 self-assigned this Apr 1, 2024
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Apr 1, 2024
@anthonykim1 anthonykim1 added area-terminal and removed triage-needed Needs assignment to the proper sub-team labels Apr 1, 2024
@AtharvaShekatkar
Copy link

@anthonykim1 Any idea when this will be resolved?

@anthonykim1
Copy link
Author

@AtharvaShekatkar I can't provide a specific date but the team is definitely aware of this.
Are you having any specific/complains to the new terminal environment variable experiment?

@AtharvaShekatkar
Copy link

@anthonykim1 No complaints. I am a starship user facing the double (.venv) issue and just wanted to know when it'll be solved.

@anthonykim1
Copy link
Author

@AtharvaShekatkar I see, did any of the suggestion #23137 work out? Can you also opt out of shell integration in your settings and see if you still see the duplicate (venv)? Please also check if virtual environment is still correctly activated in this case. This is all in the assumption with you are opt-in for Terminal env var activation experiment.

This is late (I think it might've got looked over with issue being tracked here) but to answer #23304 (comment), not too sure why it is only happening to mac in your scenario. I'm guessing one of the possibility might be from currently how we are trying to predict user's PS1 and see if there is (venv) in it.

@AtharvaShekatkar
Copy link

@anthonykim1 I'd checked the #23137 thread and tried the solutions listed there, but none worked for me. I also tried opting out of shell integration. That did get rid of the double (venv), but it didn't activate the environment. I haven't opted in for the experiment, and I'm not sure I can given that this is a work laptop.

Also, I'm not sure if this only happens on Mac, since I've only used conda with Windows. I'll try using venv and update the thread.

@AtharvaShekatkar
Copy link

@anthonykim1 The issue is fixed now. I didn't do anything, so I don't know what fixed it. Letting you know so you can stop tracking it here.

@anthonykim1
Copy link
Author

Great, thank you for letting me know! @AtharvaShekatkar Will still keep this open so we can better handle other's scenario too. Please feel free to open another issue or let me know if it comes back up again.

@anthonykim1 anthonykim1 added this to the September 2024 milestone Aug 31, 2024
@anthonykim1 anthonykim1 changed the title Activate terminal environment with hidden terminal Use shell integration to get environment variables Aug 31, 2024
@anthonykim1
Copy link
Author

Closing this against: microsoft/vscode#227467

@anthonykim1 anthonykim1 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 8, 2024
@anthonykim1 anthonykim1 removed this from the September 2024 milestone Sep 8, 2024
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
Projects
None yet
Development

No branches or pull requests

2 participants