Prompt being overwritten, leading to cwd being removed when venv is activated by the extension #22150
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

Here's an example when venv is activated manually

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

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
brettcannon commentedon Oct 4, 2023
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": falseto work around the issue.karrtikr commentedon Oct 4, 2023
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?
karrtikr commentedon Oct 4, 2023
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:
realratchet commentedon Oct 5, 2023
Switching to pre-release and toggling
pythonTerminalEnvVarActivationflag 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 isv2023.16.0pre-release isv2023.15.12301911.This works for me.
karrtikr commentedon Oct 5, 2023
That's great, we plan release to the fix in the release version officially this week.