Skip to content
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

Incorrect PS1 env being set for terminals, duplicated parenthesis #23184

Closed
michalpokusa opened this issue Apr 5, 2024 · 3 comments
Closed

Comments

@michalpokusa
Copy link

michalpokusa commented Apr 5, 2024

Type: Bug

Behaviour

Version v2024.4.0 respects VIRTUAL_ENV_PROMPT, but at the same time tries to put in in (...) , which leads to duplication:
image

image

Steps to reproduce:

  1. Install extension
  2. Create a virtual environment using python -m venv .venv
  3. Activate venv using source .venv/bin/activate
  4. Open integrated terminal in VSCode after selecting the newly created venv in Select Interpreter dropdown

I tracked down the problem to getPromptForEnv in src\client\terminals\envCollectionActivation\service.ts, specifically this if statement:

if (interpreter.type === PythonEnvType.Virtual && env.VIRTUAL_ENV_PROMPT) {
    return `(${env.VIRTUAL_ENV_PROMPT}) `;
}

When VIRTUAL_ENV_PROMPT is (.venv) , this results in ((.venv) ) .
image

Extension version: 2024.4.0
VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:20:17.278Z)
OS version: Windows_NT x64 10.0.22000
Modes:
Remote OS version: Linux x64 5.15.0-100-generic
Remote OS version: Linux x64 5.15.0-100-generic
Remote OS version: Linux x64 5.10.0-20-amd64
Remote OS version: Linux x64 5.15.0-100-generic

@clnhlzmn
Copy link

clnhlzmn commented Apr 5, 2024

I'll add that it seems this version (2024.4.0) does not set the executable bit on the deactivate script which prevents deactivating the environment unless I do

chmod +x /root/.vscode-server/extensions/ms-python.python-2024.4.0/pythonFiles/deactivate/bash/deactivate

This is happening in a remote dev container. Reverting to 2024.2.1 seems to fix this problem and the incorrect prompt.

@anthonykim1
Copy link

Thanks for filing issue! PR for the fix is on the way: #23201

anthonykim1 added a commit that referenced this issue Apr 8, 2024
Resolves: #23193 #23184

Resolve duplicated (.venv) prompt for users terminal.
Issue came from: #23080
@karthiknadig karthiknadig added this to the April 2024 milestone Apr 8, 2024
@karthiknadig
Copy link
Member

Duplicate #23193

@karthiknadig karthiknadig closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2024
@karthiknadig karthiknadig removed this from the April 2024 milestone Apr 8, 2024
anthonykim1 added a commit to anthonykim1/vscode-python that referenced this issue Apr 9, 2024
Resolves: microsoft#23193 microsoft#23184

Resolve duplicated (.venv) prompt for users terminal.
Issue came from: microsoft#23080
karthiknadig pushed a commit that referenced this issue Apr 9, 2024
Resolves: #23193 #23184

Resolve duplicated (.venv) prompt for users terminal.
Issue came from: #23080
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants