-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Environment
-
VS Code version: your version
-
Python extension version: your version
-
OS: Windows 10/11
-
Shells tested:
- PowerShell
- CMD
- Git Bash
Summary
After recent Python extension updates (last ~4–5 months), Python environment auto-activation no longer works in Terminals unless the Python Extension settings are explicitly enabled, despite extension stating they are overridden by the new python.envs.terminal.autoActivationType setting.
This is a regression. Behavior was previously consistent.
Actual Behavior
Case 1 — Python Extension settings disabled
python.terminal.activateEnvironment = false
python.terminal.activateEnvInCurrentTerminal = false
python.envs.terminal.autoActivationType = "command" // even shell startup does the same
Opening a CMD terminal results in:
F:\Project>
- No environment name
- No activation commands run
- Running a Python file uses the wrong environment, causing import failures
Expected: Environment auto-activates
Actual: No activation occurs at all
Case 2 — Python Extension settings enabled
python.terminal.activateEnvironment = true
python.terminal.activateEnvInCurrentTerminal = true
python.envs.terminal.autoActivationType = "command"
- CMD terminal now auto-activates
- Activation is delayed because commands are queued
- Running Python before activation results in errors
- Activation happens only after the script fails
Activation technically occurs, but it is unreliable.
Expected Behavior
Documentation states:
python.envs.terminal.autoActivationTypetakes precedence over (Python Extension) settings.
Therefore:
- Auto-activation should work even if legacy settings are disabled
- Activation should occur before Python execution, not after
Why This Is a Problem
- Shells cannot auto-activate unless deprecated settings are re-enabled
- Scripts run with the wrong interpreter when activation is delayed
- Legacy settings still control activation despite being marked deprecated
shellStartupmode does not activate CMD at allcommandmode activates too late (after execution begins)
This combination makes CMD activation effectively broken.
Reproduction Steps
- Disable both legacy settings:
python.terminal.activateEnvironment = false
python.terminal.activateEnvInCurrentTerminal = false
- Set:
python.envs.terminal.autoActivationType = "command"
- Open a CMD/PWSH terminal in VS Code
- Observe that the environment does not activate
- Run a Python file
- Script fails due to the wrong interpreter
- CMD activates the environment only after the failure
Notes
- PowerShell auto-activation fails
- CMD behavior has changed recently; it previously worked reliably (CMD Neither works after legacy in case of shellStartup, but that's for another issue)
- This issue is not related to conda; it also occurs with venv
- The problem appears specific to VS Code’s Python extension activation logic
- Many Windows developers depend on CMD for tooling and workflows
Request
Please restore the original behavior:
python.envs.terminal.autoActivationTypeshould be authoritative- Legacy settings should not be required for activation
- CMD activation should occur immediately, not after script execution
- CMD should be fully supported under both
shellStartupandcommandactivation modes
Logs can be provided if needed.