Skip to content

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

Closed as not planned
@michalpokusa

Description

@michalpokusa

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

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