-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Type: Bug
Behaviour
When opening a terminal, the Python virtualenv activation command (e..g source /path/to/.venv/bin/activate
) is issued too late. Most of the time, I’ve already started typing another command before activation occurs. As a result, the activation command is appended to whatever I was typing, and the combined text is executed as-is. This causes the virtualenv activation to fail, and the command I was entering is also lost.
This seems potentially dangerous, because it can result in excuting commands I never intended to run. For example, if I type rm
and the activation triggers right after, the executed command becomes: rm source /path/to/.venv/bin/activate
. This would obviously delete the listed paths.
This appears to be the same issue described in the now-closed #15719 (2021). That issue includes a video that already demonstrates the problem well, so I haven’t recorded a new one. Here's the video from the old issue:
Peek.19-03-2021.07-50.mp4
The problem seems to be shell-agnostic: I can reproduce it in both Bash and Fish. It’s also not caused by my custom shell configuration, since it still happens when running Bash with --noprofile --norc
.
Steps to reproduce:
- Open a new internal terminal (panel or editor area)
- Start typing a command immediately
- Notice that your input is appended with the virtualenv command and executed together
Diagnostic data
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
2025-09-04 13:19:15.065 [info] > pyenv which python
2025-09-04 13:19:15.066 [info] cwd: .
2025-09-04 13:19:28.051 [info] Active interpreter [/home/ige/repos/pythontest]: /home/ige/repos/pythontest/.venv/bin/python
2025-09-04 13:19:30.733 [info] Starting Pylance language server.
2025-09-04 13:19:37.000 [info] Send text to terminal: source /home/ige/repos/pythontest/.venv/bin/activate
Extension version: 2025.12.0
VS Code version: Code 1.103.1 (360a4e4fd251bfce169a4ddf857c7d25d1ad40da, 2025-08-12T16:25:40.542Z)
OS version: Linux x64 6.15.9-201.fc42.x86_64+debug
Modes:
Remote OS version: Linux x64 6.15.9-201.fc42.x86_64+debug
- Python version: 3.13.3
- Type of virtual environment used: venv
- Value of the
python.languageServer
setting: Default
User Settings
languageServer: "Pylance"
testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true
• pytestPath: "<placeholder>"
experiments
• enabled: false
• optOutFrom: ["pythonTerminalEnvVarActivation"]
Installed Extensions
Extension Name | Extension Id | Version |
---|---|---|
Bookmarks | ale | 13.5.0 |
cloudcode | goo | 2.36.0 |
code-spell-checker | str | 4.2.6 |
copilot | Git | 1.364.0 |
copilot-chat | Git | 0.30.3 |
debugpy | ms- | 2025.10.0 |
even-better-toml | tam | 0.21.2 |
geminicodeassist | goo | 2.47.0 |
gitlab-workflow | Git | 6.40.1 |
gitlens | eam | 17.4.1 |
js-debug | ms- | 1.102.0 |
markdown-all-in-one | yzh | 3.6.3 |
python | ms- | 2025.12.0 |
ruff | cha | 2025.24.0 |
shellcheck | tim | 0.38.3 |
vscode-js-profile-table | ms- | 1.0.10 |
vscode-kubernetes-tools | ms- | 1.3.26 |
vscode-markdownlint | Dav | 0.60.0 |
vscode-pylance | ms- | 2025.7.1 |
vscode-python-envs | ms- | 1.2.0 |
vscode-yaml | red | 1.18.0 |
System Info
Item | Value |
---|---|
CPUs | AMD Ryzen 7 PRO 4750U with Radeon Graphics (16 x 1409) |
GPU Status | 2d_canvas: enabled 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 trees_in_viz: disabled_off video_decode: enabled video_encode: disabled_software vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off webnn: disabled_off |
Load (avg) | 6, 6, 5 |
Memory (System) | 26.49GB (6.57GB free) |
Process Argv | --new-window --crash-reporter-id b1a9997c-d502-48ce-9353-1ad864d1ffab |
Screen Reader | no |
VM | 0% |
DESKTOP_SESSION | gnome |
XDG_CURRENT_DESKTOP | GNOME |
XDG_SESSION_DESKTOP | gnome |
XDG_SESSION_TYPE | wayland |
Item | Value |
---|---|
Remote | Dev Container: zeevending-support-backend @ unix:///run/user/1000/podman/podman.sock |
OS | Linux x64 6.15.9-201.fc42.x86_64+debug |
CPUs | AMD Ryzen 7 PRO 4750U with Radeon Graphics (16 x 3217) |
Memory (System) | 26.49GB (6.56GB free) |
VM | 0% |
A/B Experiments
vsliv368cf:30146710
vswsl492:30256859
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
747dc170:31275177
aj953862:31281341
nesew2to5:31336538
agentclaude:31350858
nes-set-on:31351930
testaa123cf:31335227
onetestforazureexp:31335613
6abeh943:31336334
0927b901:31350571
custommodel2t:31371781
45650338:31358607
0cj2b977:31352657
cloudbuttonc:31374191
retryenabled:31370050
todos-0:31378732
search_len_ctrl:31378778
3efgi100_wstrepl:31374188