Skip to content

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

Closed as not planned

Description

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

Activity

  1. clnhlzmn commented on Apr 5, 2024

    @clnhlzmn

    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.

  2. anthonykim1 commented on Apr 8, 2024

    @anthonykim1

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

  3. karthiknadig commented on Apr 8, 2024

    @karthiknadig
    Member

    Duplicate #23193

  4. locked as resolved and limited conversation to collaborators on May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions