-
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
$HOST environment variable is wrongly changed & missing context on .zshenv, .zshrc #23350
Comments
Edited the description to include more information on the commands in the shell scripts used to try to fix host variable. |
Hello @tplobo, thanks for filing the issue.
See if you can still repro the behavior afterwards. |
hey @anthonykim1, thanks for the reply
Indeed, after adding your suggestion to the project
so the host in my prompt is corrected to the output of
so Now, if to that setup I add a Finally, if I remove both |
Apologies for late response but I think this may be related to Python ext. not having context over zshenv or zshrc, zprofile, etc files. I think you should stick to
But for missing context of $HOST in your zshrc, its probably because combination of: extension has no context of what is inside your shell initialization file AND conda specific issue that you mentioned. For the first case, you might notice other environment variables that are missing here as well. We are planning to remove the terminal env var experiment for better experience where we WOULD have context of what is inside your zshrc, though but I can't guarantee you the timeline. Related: microsoft/vscode#227467 As far as:
Python interpreter would be remembered, but Im not sure if this really means that you wont need conda init related in your zshrc file. Otherwise, I will continue to work on the VS Code API so that extensions (such as Python extension) have better understanding of user's environment in shell specific way. |
Consolidating this with #23604 as it seems similar in corrupted env vars (although this one may be maybe more conda specific |
Type: Bug
Behaviour & Steps to reproduce
I'm using
mambaforge
as an environment manager and run shells with zsh.In my understanding one of the last updates made the "Python Interpreter" setting to be remembered and automatically retrieved when a project is opened. Which means the contents
are not needed in
.zshrc
anymore. This is nice, but it has created a few associated problems.The first problem: this has modified some environment variables in terminals running an environment, for example:
instead of being equal to the output of
hostname
(opening vscode instance outside project folder):This is apparently a known issue with conda.
As a potential fix, I have tried to set a
.vscode/.zshenv
to enforce the proper value for HOST. But this is overwritten by the activation of the mamba environment, which happens after sourcing.zshenv
. Here's the code:The second problem: to remedy that situation, I have migrated the lines in
.zshenv
to a.../activate.d/fix_host.sh
file as a mamba post-activation script. However, due to VSCode automatically loading the Python Interpreter, the mamba environment is apparently never properly activated, so the post-activation scripts are never run. In fact, after opening VSCode in the project folder:and
so it looks like conda/mamba init are skipped.
Extension version: 2024.7.11241010
VS Code version: Code 1.89.0 (b58957e67ee1e712cebf466b995adf4c5307b2bd, 2024-05-01T02:10:10.196Z)
OS version: Darwin x64 23.4.0
Modes:
python.languageServer
setting: DefaultUser Settings
Installed Extensions
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: