Description
Type: Bug
Behaviour
Depending on the order of terminal environment changes, path modifications will overwrite path mods from other extensions.
Particularly, it seems that I get ONLY prepends or ONLY appends, and this differs on a per-workspace basis.
This culminates in things like Python environments not activating in certain workspaces, or debugpy not being available in certain workspaces (among other things)
Steps to reproduce:
Depending on the workspace, the order of terminal environment contributions seems to change. This seems to affect whether path prepends or path appends take priority.
I demonstrate this with a python virtual environment:
- Open a workspace or folder which has the python interpreter set at a workspace level
- Open a new NuShell, Powershell, or CMD integrated terminal
- Ensure that
ms-python.python
, andms-python.debugpy
are contributing to the environment.
a. You can do this by hovering over the terminal icon (next to the+
add terminal button) and clickingShow Environment Contributions
in the pop-up.
b. I have other things contributing to the environment, such asGitHub.copilot-chat
. In this case,
i.ms-python.python
PRE-pends to path (add BEFORE)
ii.ms-python.debugpy
andGitHub.copilot-chat
APpend to path (add AFTER) - View the path:
a. NuShell:$env.Path | last 3 | prepend ($env.Path | first 3)
b. Powershell:($env:Path -split ';' | select -First 3) + ($env:Path -split ';' | select -Last 3)
c. cmd:echo %PATH%
- Inspect the path. See that only EITHER prepends or appends were made. i.e. either the python virtual environment was prepended, or the github copilot and debugpy no-config debug were appended to path.
Note: I was able to "fix" this (change the order) for one workspace by:
- Closing VSCode and Deleting the relevant "workspace workspace" dir and "folder workspace" dir from
AppData\Roaming\Code\User\workspaceStorage
- Deleting
Code\User\globalStorage\state.vscdb
WARNING: THIS WILL DELETE YOUR VSCODE STATE. DO NOT DO THIS. - Removing references to the folder/workspace from
globalStorage\storage.json
- Setting up VSCode
- Opening the folder
- Setting a workspace-level python interpreter
- Saving the workspace
- Deleting and re-creating the virtualenv
- Opening a terminal to check that the order of environment contributions is different.
Note: I don't actually know if the order of environment contributions is what determines whether prepends or appends work. What I do know is that this is a per-workspace behavior difference.
If I only do steps 1 and 3, then the issue is not fixed once I open VSCode. However, doing step 2 doesn't seem to be the lynchpin, as this process didn't fix every workspace, only the one I fully scrubbed.
Diagnostic data
Output for Python
in the Output
panel
Note: The output is shown for a workspace for which the path injection DOESN'T WORK. However, this output looks almost identical to that of a workspace for which it DOES work.
2025-05-20 20:49:55.910 [info] Experiment 'pythonRecommendTensorboardExt' is active
2025-05-20 20:49:55.910 [info] Experiment 'pythonSurveyNotification' is active
2025-05-20 20:49:55.910 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2025-05-20 20:49:55.910 [warning] Dir "c:\Users\kenbl\Documents\.projects\rss\.pixi\envs" is not watchable (directory does not exist)
2025-05-20 20:49:55.967 [info] Python interpreter path: .\.venv\Scripts\python.exe
2025-05-20 20:49:55.985 [info] > pyenv which python
2025-05-20 20:49:55.985 [info] cwd: .
2025-05-20 20:49:56.060 [warning] Shell integration may not be active, environment activated may be overridden by the shell.
2025-05-20 20:49:57.299 [info] > overlay use ./.venv/Scripts/activate.nu && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2025.6.1-win32-x64/python_files/printEnvVariables.py
2025-05-20 20:49:57.300 [info] shell: nushell
2025-05-20 20:49:57.345 [error] getActivatedEnvironmentVariables Error: Command failed: overlay use c:/Users/kenbl/Documents/.projects/rss/.venv/Scripts/activate.nu && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:/Users/kenbl/.vscode/extensions/ms-python.python-2025.6.1-win32-x64/python_files/printEnvVariables.py
Error: nu::parser::shell_andand
x The '&&' operator is not supported in Nushell
,-[source:1:78]
1 | overlay use c:/Users/kenbl/Documents/.projects/rss/.venv/Scripts/activate.nu && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:/Users/kenbl/.vscode/extensions/ms-python.python-2025.6.1-win32-x64/python_files/printEnvVariables.py
: ^|
: `-- instead of '&&', use ';' or 'and'
`----
help: use ';' instead of the shell '&&', or 'and' instead of the boolean
'&&'
at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at ChildProcess.exithandler (node:child_process:423:12)
at ChildProcess.emit (node:events:536:35)
at maybeClose (node:internal/child_process:1104:16)
at Socket.<anonymous> (node:internal/child_process:456:11)
at Socket.emit (node:events:524:28)
at Pipe.<anonymous> (node:net:343:12) {
code: 1,
killed: false,
signal: null,
cmd: "overlay use c:/Users/kenbl/Documents/.projects/rss/.venv/Scripts/activate.nu && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:/Users/kenbl/.vscode/extensions/ms-python.python-2025.6.1-win32-x64/python_files/printEnvVariables.py"
}
2025-05-20 20:49:57.354 [info] > ./.venv/Scripts/activate.bat && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2025.6.1-win32-x64/python_files/printEnvVariables.py
2025-05-20 20:49:57.354 [info] shell: commandPrompt
2025-05-20 20:49:58.128 [info] > C:\Python312\python.exe ~/.vscode/extensions/ms-python.python-2025.6.1-win32-x64/python_files/printEnvVariables.py
2025-05-20 20:49:58.128 [info] shell: commandPrompt
2025-05-20 20:49:58.215 [info] Prepending environment variable PATH in collection with C:\Users\kenbl\Documents\.projects\rss\.venv\Scripts; {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-20 20:49:58.215 [info] Setting environment variable PROMPT in collection to (rss) $P$G {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-20 20:49:58.215 [info] Setting environment variable VIRTUAL_ENV in collection to C:\Users\kenbl\Documents\.projects\rss\.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-20 20:49:58.215 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to rss {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-20 20:49:58.215 [info] Setting environment variable _OLD_VIRTUAL_PROMPT in collection to $P$G {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-20 20:50:00.149 [info] Starting Pylance language server.
2025-05-20 20:56:28.805 [info] Shell integration status changed, can confirm it's working.
2025-05-20 20:56:28.809 [info] > overlay use ./.venv/Scripts/activate.nu && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2025.6.1-win32-x64/python_files/printEnvVariables.py
2025-05-20 20:56:28.809 [info] shell: nushell
2025-05-20 20:56:28.840 [error] getActivatedEnvironmentVariables Error: Command failed: overlay use c:/Users/kenbl/Documents/.projects/rss/.venv/Scripts/activate.nu && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:/Users/kenbl/.vscode/extensions/ms-python.python-2025.6.1-win32-x64/python_files/printEnvVariables.py
Error: nu::parser::shell_andand
x The '&&' operator is not supported in Nushell
,-[source:1:78]
1 | overlay use c:/Users/kenbl/Documents/.projects/rss/.venv/Scripts/activate.nu && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:/Users/kenbl/.vscode/extensions/ms-python.python-2025.6.1-win32-x64/python_files/printEnvVariables.py
: ^|
: `-- instead of '&&', use ';' or 'and'
`----
help: use ';' instead of the shell '&&', or 'and' instead of the boolean
'&&'
at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at ChildProcess.exithandler (node:child_process:423:12)
at ChildProcess.emit (node:events:536:35)
at maybeClose (node:internal/child_process:1104:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {
code: 1,
killed: false,
signal: null,
cmd: "overlay use c:/Users/kenbl/Documents/.projects/rss/.venv/Scripts/activate.nu && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:/Users/kenbl/.vscode/extensions/ms-python.python-2025.6.1-win32-x64/python_files/printEnvVariables.py"
}
2025-05-20 20:56:28.844 [info] > ./.venv/Scripts/activate.bat && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2025.6.1-win32-x64/python_files/printEnvVariables.py
2025-05-20 20:56:28.844 [info] shell: commandPrompt
2025-05-20 20:56:28.908 [info] Prepending environment variable PATH in collection with C:\Users\kenbl\Documents\.projects\rss\.venv\Scripts; {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-20 20:56:28.908 [info] Setting environment variable PROMPT in collection to (rss) $P$G {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-20 20:56:28.908 [info] Setting environment variable VIRTUAL_ENV in collection to C:\Users\kenbl\Documents\.projects\rss\.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-20 20:56:28.908 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to rss {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-05-20 20:56:28.908 [info] Setting environment variable _OLD_VIRTUAL_PROMPT in collection to $P$G {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
Output for Python Language Server
in the Output
panel
2025-05-20 20:49:57.442 [info] (Client) Pylance async client (2025.5.1) started with python extension (2025.6.1)
2025-05-20 20:49:59.653 [info] [Info - 8:49:59 PM] (747840) Server root directory: file:///c%3A/Users/kenbl/.vscode/extensions/ms-python.vscode-pylance-2025.5.1/dist
2025-05-20 20:49:59.821 [info] [Info - 8:49:59 PM] (747840) Pylance language server 2025.5.1 (pyright version 1.1.400, commit b962ffc2) starting
2025-05-20 20:50:00.134 [info] [Info - 8:50:00 PM] (747840) Starting service instance "rss" for workspace "c:\Users\kenbl\Documents\.projects\rss"
2025-05-20 20:50:00.679 [info] [Info - 8:50:00 PM] (747840) Setting environmentName for service "rss": "3.12.2 (.venv venv)"
2025-05-20 20:50:00.679 [info] [Info - 8:50:00 PM] (747840) Setting pythonPath for service "rss": "c:\Users\kenbl\Documents\.projects\rss\.venv\Scripts\python.exe"
2025-05-20 20:50:00.679 [info] [Info - 8:50:00 PM] (747840) No include entries specified; assuming c:\Users\kenbl\Documents\.projects\rss
2025-05-20 20:50:00.679 [info] [Info - 8:50:00 PM] (747840) Auto-excluding **/node_modules
2025-05-20 20:50:00.694 [info] [Info - 8:50:00 PM] (747840) Auto-excluding **/__pycache__
2025-05-20 20:50:00.700 [info] [Info - 8:50:00 PM] (747840) Auto-excluding **/.*
2025-05-20 20:50:00.814 [info] [Info - 8:50:00 PM] (747840) Assuming Python version 3.12.2.final.0
2025-05-20 20:50:01.042 [info] [Info - 8:50:01 PM] (747840) Found 255 source files
2025-05-20 20:50:01.061 [info] [Info - 8:50:01 PM] (747840) Setting environmentName for service "rss": "3.12.2 (.venv venv)"
2025-05-20 20:50:01.061 [info] [Info - 8:50:01 PM] (747840) Setting pythonPath for service "rss": "c:\Users\kenbl\Documents\.projects\rss\.venv\Scripts\python.exe"
2025-05-20 20:50:01.061 [info] [Info - 8:50:01 PM] (747840) No include entries specified; assuming c:\Users\kenbl\Documents\.projects\rss
2025-05-20 20:50:01.061 [info] [Info - 8:50:01 PM] (747840) Auto-excluding **/node_modules
2025-05-20 20:50:01.061 [info] [Info - 8:50:01 PM] (747840) Auto-excluding **/__pycache__
2025-05-20 20:50:01.061 [info] [Info - 8:50:01 PM] (747840) Auto-excluding **/.*
2025-05-20 20:50:01.120 [info] [Info - 8:50:01 PM] (747840) Assuming Python version 3.12.2.final.0
2025-05-20 20:50:01.323 [info] [Info - 8:50:01 PM] (747840) Found 255 source files
2025-05-20 20:50:01.331 [info] [Info - 8:50:01 PM] (747840) BG: Priority queue background worker(2) root directory: file:///c%3A/Users/kenbl/.vscode/extensions/ms-python.vscode-pylance-2025.5.1/dist
2025-05-20 20:50:01.331 [info] [Info - 8:50:01 PM] (747840) BG: Priority queue background worker(2) started
Extension version: 2025.6.1
VS Code version: Code 1.100.2 (848b80aeb52026648a8ff9f7c45a9b0a80641e2e, 2025-05-14T21:47:40.416Z)
OS version: Windows_NT x64 10.0.19045
Modes:
- Python version (& distribution if applicable, e.g. Anaconda): 3.12.2
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
- Value of the
python.languageServer
setting: Default
User Settings
languageServer: "Pylance"
Installed Extensions
Extension Name | Extension Id | Version |
---|---|---|
activitusbar | Gru | 0.0.47 |
autodocstring | njp | 0.6.1 |
better-cpp-syntax | jef | 1.27.1 |
bracketeer | pus | 1.3.1 |
change-case | wma | 1.0.0 |
cmake | twx | 0.0.17 |
cmake-tools | ms- | 1.20.53 |
copilot | Git | 1.322.0 |
copilot-chat | Git | 0.27.1 |
cpptools | ms- | 1.25.3 |
cpptools-extension-pack | ms- | 1.3.1 |
cpptools-themes | ms- | 2.0.0 |
csharp | ms- | 2.76.27 |
daily | sld | 6.0.3 |
dainty-vscode | ale | 1.1.22 |
data-workspace-vscode | ms- | 0.6.2 |
datawrangler | ms- | 1.22.0 |
debugpy | ms- | 2025.8.0 |
docker | doc | 0.6.0 |
doxdocgen | csc | 1.4.0 |
es7-react-js-snippets | dsz | 4.4.3 |
even-better-toml | tam | 0.21.2 |
expand-selection-to-scope | vit | 0.2.0 |
gitlens | eam | 17.1.0 |
identical-sublime-monokai-csharp-theme-colorizer | max | 1.2.3 |
isort | ms- | 2025.0.0 |
java | red | 1.42.0 |
js-debug | ms- | 1.100.1 |
js-debug-companion | ms- | 1.1.3 |
jupyter | ms- | 2025.4.0 |
jupyter-keymap | ms- | 1.1.2 |
jupyter-renderers | ms- | 1.1.0 |
latex-utilities | tec | 0.4.14 |
latex-workshop | Jam | 10.9.1 |
makefile-tools | ms- | 0.12.17 |
markdown-all-in-one | yzh | 3.6.3 |
mssql | ms- | 1.32.0 |
oceanic-monokai | und | 0.0.1 |
open-in-browser | igo | 1.0.2 |
platformio-ide | pla | 3.3.4 |
powershell | ms- | 2025.0.0 |
python | ms- | 2025.6.1 |
rainbow-csv | mec | 3.19.0 |
remote-containers | ms- | 0.413.0 |
remote-explorer | ms- | 0.5.0 |
remote-server | ms- | 1.5.2 |
remote-ssh | ms- | 0.120.0 |
remote-ssh-edit | ms- | 0.87.0 |
remote-wsl | ms- | 0.99.0 |
ruff | cha | 2025.22.0 |
rust-analyzer | rus | 0.3.2466 |
sql-bindings-vscode | ms- | 0.4.1 |
sql-database-projects-vscode | ms- | 1.5.2 |
sublime-keybindings | ms- | 4.1.10 |
sublime-text-4-theme | Emi | 1.1.2 |
supermaven | Sup | 1.1.12 |
theme-monokai-pro-vscode | mon | 2.0.6 |
transpose | v4r | 0.0.6 |
vetur | oct | 0.37.3 |
vsc-python-indent | Kev | 1.21.0 |
vscode-django | bat | 1.15.0 |
vscode-docker | ms- | 1.29.6 |
vscode-dotnet-runtime | ms- | 2.3.3 |
vscode-eslint | dba | 3.0.10 |
vscode-github-actions | git | 0.27.1 |
vscode-html-css | ecm | 2.0.13 |
vscode-js-profile-table | ms- | 1.0.10 |
vscode-jupyter-cell-tags | ms- | 0.1.9 |
vscode-jupyter-slideshow | ms- | 0.1.6 |
vscode-paste-and-indent | Rub | 0.0.8 |
vscode-proto3 | zxh | 0.5.5 |
vscode-pull-request-github | Git | 0.110.0 |
vscode-pylance | ms- | 2025.5.1 |
vscode-react-native | msj | 1.13.0 |
vscode-yaml | red | 1.18.0 |
vsliveshare | ms- | 1.0.5948 |
zoterolatex | bna | 0.4.1 |
System Info
Item | Value |
---|---|
CPUs | AMD Ryzen 9 7900X 12-Core Processor (24 x 4691) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: enabled_on 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 vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
Load (avg) | undefined |
Memory (System) | 63.14GB (23.46GB free) |
Process Argv | --crash-reporter-id fdf58350-4bde-4f0f-94e7-09c3724edea9 |
Screen Reader | no |
VM | 36% |
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
pythonvspyt551:31249599
vscod805cf:30301675
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
pythonrstrctxt:31112756
nativeloc2:31192216
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
9064b325:31222308
copilot_t_ci:31222730
e5gg6876:31282496
pythoneinst12:31285622
bgtreat:31268568
4gafe986:31271826
c7cif404:31309971
996jf627:31283433
pythonrdcb7cf:31303019
usemplatestapi:31297334
0aa6g176:31307128
7bj51361:31289155
747dc170:31275177
pylancecolor:31309108
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
gendocf:31295004
j6a0c355:31309728