vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Opening a PowerShell 7 terminal in VSCode results in an infinite entering

Open therealozp opened this issue 1 year ago • 7 comments

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:

  1. Kill the terminal
  2. Open the integrated terminal with the label pwsh (I assume this is the default for PowerShell 7

Image

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.

therealozp avatar Oct 17 '24 03:10 therealozp

Just my two cents.

Anything in profile?

albertosantini avatar Oct 17 '24 06:10 albertosantini

Or something related to shell integration: https://code.visualstudio.com/docs/terminal/shell-integration

Maybe a try disabling it:

"terminal.integrated.shellIntegration.enabled": false

albertosantini avatar Oct 17 '24 06:10 albertosantini

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!

therealozp avatar Oct 17 '24 13:10 therealozp

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?

Image

albertosantini avatar Oct 17 '24 14:10 albertosantini

See also https://github.com/microsoft/vscode/issues/221686

albertosantini avatar Oct 17 '24 14:10 albertosantini

The path for my PowerShell executable is correct. This is what I have right now: Image

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:

terminal trace logs.txt

therealozp avatar Oct 17 '24 15:10 therealozp

bump

therealozp avatar Oct 19 '24 01:10 therealozp

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.

therealozp avatar Oct 20 '24 22:10 therealozp

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.

meganrogge avatar Oct 21 '24 19:10 meganrogge