-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Refresh integrated terminal with .env variables after changing .env file #24815
Comments
Is there any additional data I can provide to help with this? |
Hello @ScottWilliamAnderson Thanks for filing this issue. Few things to clarify before I dig into this further. Q1. Are you able to get the terminal with updated variables from your .env when you kill your current terminal and launch a "new", fresh terminal?
Q2. Do you mean you can launch the terminal with the "relaunch terminal" button, but just not have your updated variables from your updated .env file? I did see
but just wanted to triple check. Q3. Which shell are you using on your Windows machine? Thanks again. |
Also, another important one is: Are you able to repro this outside of Python experience? |
Hi @anthonykim1, thank you for taking a look at this.
Yes, in a Python workspace, the newly launched terminals respect the latest saved .env variables.
I am using Powershell 7.5.0
I came across something strange digging further into this:
I find this actually easier than having to navigate my mouse within the hover on the terminal name. Using the Keyboard shortcut or invoking the same command via f1, works as expected. I could improve slightly my setup by debugging this and pinning down the cause of the failed relaunch using the hover link, but I don't think it's worth the time now that I have the keyboard shortcut. I suppose my original curiosity still stands,
So e.g. if you are running a server on your integrated terminal, the only way for it to update its environment variables with new .env data is to shut it down and relaunch it, given you have to relaunch the terminal its living in. Thanks! |
Type: Bug
Behaviour
I've found that there is no way for me to update the living integrated terminal with the updated .env variables, is that right? The only way is to kill the terminal and start a new one. Relaunch terminal does not relaunch it, and does not update environment variables
Steps to reproduce:
create a .env file in a python project folder, if you make any changes to it, your terminal will show an orange warning triangle and suggest either Relaunching the terminal or Show environment contributions.
Your newly added environment variables from the .env will never arrive to already launched terminals.
Diagnostic data
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Extension version: 2025.0.0
VS Code version: Code 1.97.1 (e249dada235c2083c83813bd65b7f4707fb97b76, 2025-02-10T13:13:58.153Z)
OS version: Windows_NT x64 10.0.26100
Modes:
python.languageServer
setting: PylanceUser Settings
Installed Extensions
A/B Experiments
The text was updated successfully, but these errors were encountered: