Skip to content

Sung/vscode-env-vars #4803

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

Merged
merged 13 commits into from
Jun 25, 2025
Merged

Sung/vscode-env-vars #4803

merged 13 commits into from
Jun 25, 2025

Conversation

sungchun12
Copy link
Contributor

Based on the newest updates to env var debugging with the extension.

@sungchun12 sungchun12 requested review from treysp and benfdking June 24, 2025 21:29
@sungchun12 sungchun12 marked this pull request as ready for review June 24, 2025 21:30
sungchun12 and others added 3 commits June 24, 2025 16:11
- Set the environment variables in the python environment that the extension uses. You can find detailed instructions [here](https://code.visualstudio.com/docs/python/environments#_environment-variables)

### Python environment woes
#### Troubleshooting Environment Variables
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a slightly werid hierarchy:

Troublehsooting

Environment variables

Troubleshooting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed subheader

Comment on lines 158 to 160
- Open VSCode from a terminal that sets environment variables in its configuration file (e.g., `.bashrc` for Bash or `.zshrc` for Zsh). The variables will automatically be picked up by the language server only if you explicitly export them in the shell configuration file like `export ENV_VAR=value`.
- Use environment variables pulled from somewhere else dynamically (e.g. a `.env` file) in your root project directory. This will automatically be picked up by the language server.
- Set the environment variables in the python environment that the extension uses. You can find detailed instructions [here](https://code.visualstudio.com/docs/python/environments#_environment-variables)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't quite what was intended beforehand, but I'm happy to clarify it.

  1. Open VSCode from a terminal that has the variables set is not about opening shells that have the variables set, if you open VSCode from a terminal with env vars set, it inherits them.

That's different to

  1. The LSP server runs in your shell, and anything you have configured in there gets picked up

  2. You can manually pull in vars in a Python config file as you wish.

  3. .env gets pulled because of the Python environment setup. It's not a separate thing. That's how it's being pulled in

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Updated for accuracy.

3. Print the environment variables based on the instructions above to verify the changes have taken effect.

### Python environment troubleshooting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Same here RE title

Troubleshooting

Python environment troubleshooting

The additional troubleshooting feels a little redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced with "issues"

@sungchun12 sungchun12 requested a review from benfdking June 25, 2025 16:23
@sungchun12 sungchun12 merged commit f3e53b7 into main Jun 25, 2025
25 checks passed
@sungchun12 sungchun12 deleted the sung/vscode-env-vars branch June 25, 2025 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants