microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.31k stars 1.18k forks source link

venv prefix has no parentheses #24316

Open Phrogz opened 2 hours ago

Phrogz commented 2 hours ago

Type: Bug

Behaviour

In a virtual environment the Terminal does not show parentheses around the .venv prefix.

Steps to reproduce:

  1. Install WSL2 with Ubuntu 24.04 on Windows 11.
    • Unknown which of these versions is required to reproduce.
  2. Open VS Code and use WSL extension to connect to Ubuntu.
  3. In a new folder, issue Python: Create Environment… and select Venv and a Python 3.13 interpreter.
    • Unknown if 3.13 is required to reproduce.
  4. Issue Python: Create Terminal

EXPECTED: Same PS1 prompt as seen when activating the venv in a WSL terminal: (.venv) gkistner@wsl:~/work/test$

ACTUAL: The prompt has the correct colors separating the pieces, but lacks parentheses or space: .venvgkistner@wsl:~/work/test$

image showing both VS Code Terminal and standard Terminal prompts

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

``` 2024-10-16 13:33:00.848 [info] Experiment 'pythonRecommendTensorboardExt' is active 2024-10-16 13:33:00.848 [info] Experiment 'pythonTerminalEnvVarActivation' is active 2024-10-16 13:33:00.848 [info] Experiment 'pythonTestAdapter' is active 2024-10-16 13:33:00.848 [warning] Dir "/home/gkistner/work/test/.pixi/envs" is not watchable (directory does not exist) 2024-10-16 13:33:00.940 [info] Default formatter is set to null for workspace /home/gkistner/work/test 2024-10-16 13:33:01.206 [info] Python interpreter path: ./.venv/bin/python 2024-10-16 13:33:01.329 [info] > pyenv which python 2024-10-16 13:33:01.329 [info] cwd: . 2024-10-16 13:33:01.775 [info] > pixi --version 2024-10-16 13:33:01.966 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode-server/extensions/ms-python.python-2024.16.1-linux-x64/python_files/printEnvVariables.py 2024-10-16 13:33:01.966 [info] shell: bash 2024-10-16 13:33:01.996 [info] > /bin/python3 ~/.vscode-server/extensions/ms-python.python-2024.16.1-linux-x64/python_files/printEnvVariables.py 2024-10-16 13:33:01.996 [info] shell: bash 2024-10-16 13:33:02.036 [info] Setting environment variable VIRTUAL_ENV in collection to /home/gkistner/work/test/.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-10-16 13:33:02.036 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to .venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-10-16 13:33:02.036 [info] Prepending environment variable PS1 in collection with .venv {"applyAtShellIntegration":true,"applyAtProcessCreation":false} 2024-10-16 13:33:02.036 [info] Prepending environment variable PATH in collection with /home/gkistner/.vscode-server/extensions/ms-python.python-2024.16.1-linux-x64/python_files/deactivate/bash:/home/gkistner/work/test/.venv/bin: {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-10-16 13:33:02.037 [info] Send text to terminal: /bin/python3 /home/gkistner/.vscode-server/extensions/ms-python.python-2024.16.1-linux-x64/python_files/printEnvVariablesToFile.py /home/gkistner/.vscode-server/extensions/ms-python.python-2024.16.1-linux-x64/python_files/deactivate/bash/envVars.txt 2024-10-16 13:33:02.839 [info] Starting Pylance language server. ```

Extension version: 2024.16.1 VS Code version: Code 1.94.2 (384ff7382de624fb94dbaf6da11977bba1ecd427, 2024-10-09T16:08:44.566Z) OS version: Windows_NT x64 10.0.22631 Modes: Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2

User Settings

``` languageServer: "Pylance" ```

Installed Extensions |Extension Name|Extension Id|Version| |---|---|---| |Data Wrangler|ms-toolsai.datawrangler|1.10.0| |Even Better TOML|tamasfe.even-better-toml|0.19.2| |GitLens — Git supercharged|eamodio.gitlens|15.6.1| |JavaScript Debugger|ms-vscode.js-debug|1.94.0| |Jupyter|ms-toolsai.jupyter|2024.9.1| |Jupyter Cell Tags|ms-toolsai.vscode-jupyter-cell-tags|0.1.9| |Jupyter Notebook Renderers|ms-toolsai.jupyter-renderers|1.0.19| |Jupyter Slide Show|ms-toolsai.vscode-jupyter-slideshow|0.1.6| |markdownlint|DavidAnson.vscode-markdownlint|0.56.0| |Pylance|ms-python.vscode-pylance|2024.10.1| |Python|ms-python.python|2024.16.1| |Python Debugger|ms-python.debugpy|2024.12.0| |Python Environment Manager|donjayamanne.python-environment-manager|1.2.4| |Rainbow CSV|mechatroner.rainbow-csv|3.12.0| |Ruff|charliermarsh.ruff|2024.50.0| |Table Visualizer for JavaScript Profiles|ms-vscode.vscode-js-profile-table|1.0.10| |WSL: Recommender|ms-vscode-remote.remote-wsl-recommender|0.0.19| |YAML|redhat.vscode-yaml|1.15.0|
System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz (16 x 2304)| |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)|31.87GB (16.98GB free)| |Process Argv|--crash-reporter-id 2e89e02c-9991-447b-b330-82f1b9d96db4| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 5.15.153.1-microsoft-standard-WSL2| |CPUs|Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz (16 x 0)| |Memory (System)|15.55GB (14.32GB free)| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 accentitlementst:30995554 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 bdiig495:31013172 dvdeprecation:31068756 dwnewjupyter:31046869 impr_priority:31102340 nativerepl1:31139838 refactort:31108082 pythonrstrctxt:31112756 wkspc-onlycs-t:31132770 wkspc-ranged-t:31151552 cf971741:31144450 defaultse:31146405 iacca2:31156134 notype1cf:31157160 5fd0e150:31155592 iconenabled:31158251 ```
Phrogz commented 2 hours ago

Is this a regression caused by fixing #23193? Was #23080 trying to fix this for a specific Windows/WSL situation? I don't know, but I thought I should link to both of those.