Skip to content

Prompt being overwritten, leading to cwd being removed when venv is activated by the extension #22150

Closed as not planned

Description

Discussed in #22148

Originally posted by realratchet October 4, 2023
Hello,

I've been using ~6 month old vscode (1.76.2) until recently recently, when decided to update it to 1.81.1 (because 1.82 has broken sourcemap reloading) and noticed that python extension has started hiding CWD in the terminal when it activates it. I've tried looking any references to it in json/discussion/tickets but any keywords I could think off of didn't find anything useful.

Here's an example of no venv activated
image

Here's an example when venv is activated manually
image

Here's an example when venv is activated by the extension
image

Is there a way to disable it, I've been using this for 3 days now and I'm at my breaking point to where I permanently switch to 1.76.2. I can't seem to find any user config that disables this behaviour. I know that it shows the current directory near the terminal icon but it's way out of place because you actually have to move your focus and even then it doesn't show full path if you're dealing with directory tree that has directories with same name.

Thanks.

Activity

  1. brettcannon commented on Oct 4, 2023

    @brettcannon
    MemberAuthor

    This is a bug probably due to us attempting to add the virtual environment name to your shell prompt.

    You can turn off environment activation via "python.terminal.activateEnvironment": false to work around the issue.

  2. karrtikr commented on Oct 4, 2023

    @karrtikr

    Ratchet (@realratchet) You're probably using an older version of Python extension which had this bug. Can you switch to the pre-release version of the extension on the latest version of VS Code?

    image

  3. karrtikr commented on Oct 4, 2023

    @karrtikr

    Also, you'll probably need to switch to latest version of VS Code.

    If you decide you do not want to go this way, you can disable the experiment until you're ready to upgrade:

    "python.experiments.optOutFrom": ["pythonTerminalEnvVarActivation"]
  4. realratchet commented on Oct 5, 2023

    @realratchet

    Also, you'll probably need to switch to latest version of VS Code.

    If you decide you do not want to go this way, you can disable the experiment until you're ready to upgrade:

    "python.experiments.optOutFrom": ["pythonTerminalEnvVarActivation"]

    Switching to pre-release and toggling pythonTerminalEnvVarActivation flag on/off is seems to have resolved it. However, using release version alone and doing the same didn't. The release version on my vscode is v2023.16.0 pre-release is v2023.15.12301911.

    This works for me.

  5. karrtikr commented on Oct 5, 2023

    @karrtikr

    That's great, we plan release to the fix in the release version officially this week.

  6. locked as resolved and limited conversation to collaborators on Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugtriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions