Opening a PowerShell 7 terminal in VSCode results in an infinite entering
Does this issue occur when all extensions are disabled?: Yes/No
- VS Code Version: 1.94.2
- OS Version: Windows 23H2 OS Build 22631.4317
- PowerShell Version: 7.4.5
Steps to Reproduce:
- Kill the terminal
- Open the integrated terminal with the label
pwsh(I assume this is the default for PowerShell 7
Some notes:
- I have started Extension Bisect, and even with no extensions enabled, the issue still occurs.
- I tried reinstalling PowerShell 7, Visual Studio Code, which did not solve the problem either.
- The other terminals (PowerShell 5, command prompt, and Git Bash) do not encounter the same problem.
Just my two cents.
Anything in profile?
Or something related to shell integration: https://code.visualstudio.com/docs/terminal/shell-integration
Maybe a try disabling it:
"terminal.integrated.shellIntegration.enabled": false
Nothing was originally in the PS profile.
I updated the profile with those found in the link provided above if ($env:TERM_PROGRAM -eq "vscode") { . "$(code --locate-shell-integration-path pwsh)" }, but it still had the same issue.
I cleared the profile and disabled shellIntegration, but the issue still occurs.
PowerShell seems to be doing fine in Windows Terminal, only in VSCode does this issue happen. Thanks for the help!
Here I cannot reproduce it and I have almost the same setup (diff Windows 24H2).
When you start Powershell, you should see as first line
PowerShell 7.4.5
And, please, check this:
- Control Palette
Ctrl + Shift + P Terminal: Select Default Profile
Do you see the correct path for Powershell profile?
See also https://github.com/microsoft/vscode/issues/221686
The path for my PowerShell executable is correct. This is what I have right now:
As you said, when opening the terminal, it does briefly show the line Powershell 7.4.5 for a quick second, and then it just gets completely obliterated by the entering lines that follow it.
I don't have anything in my $PROFILE right now as the [#221686] thread might suggest, but I have gathered some logs with trace anyway. Please let me know if this helps:
bump
update:
Looks like disabling shellIntegration seems to be helping, but it comes at a cost of losing command highlighting and autofilling that pwsh 7 has. Still looking for a fix because shellIntegration worked flawlessly before, but just recently become buggy.
The only way this could be happening imo is if you still have some powershell profile that is interacting with shell integration. Looks like you can define different levels of pwsh profile (for different users, hosts). I'd suggest checking all of those. I cannot repro, so cannot investigate.