Shell Integration Script for Powershell 7 Terminals (shellIntegration.ps1) is adding junk data into the console after typing more than one character. #236841
Description
Does this issue occur when all extensions are disabled?: Yes/No
Yes
- VS Code Version: 1.96.2 (user setup)
- OS Version: Windows 10 Pro x64 22H2 (OS Build 19045.5247)
Full VSCode Version Details:
Version: 1.96.2 (user setup)
Commit: fabdb6a30b49f79a7aba0f2ad9df9b399473380f
Date: 2024-12-19T10:22:47.216Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.19045
Steps to Reproduce:
- Open a new Powershell 7 terminal. (The issue doesn't occur in the default SHELL INTEGRATION terminal, but with additional created terminals)
- Type more than one character in the terminal.
- Observe that the terminal gets polluted with a bunch of random grayed out code:
Here is a screen recording of the behavior:
https://i.imgur.com/PUNU2n9.mp4
Here's a screenshot of what's being injected into the terminal:
So I opened C:\Users\username\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\common\scripts\shellIntegration.ps1
.
If I add a return statement immediately at the top of this file and restart VSCode, the issue no longer occurs. But I have yet to figure out what part of the code is causing this behavior.
I'm wondering if this has anything to do with the PSReadLine module, because the shellIntegration.ps1
script is doing a lot of interaction with it.
Here are my terminal settings in settings.json:
"terminal.integrated.profiles.windows": {
"PowerShell 7": {
"path": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
"icon": "terminal-powershell"
},
"PowerShell 7 Preview": {
"path": "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe",
"icon": "terminal-powershell"
},
"PowerShell 5": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": "C:\\Windows\\system32\\cmd.exe",
"icon": "terminal-cmd"
}
},
"terminal.integrated.cwd": "D:\\Dev\\",
"terminal.integrated.persistentSessionReviveProcess": "never",
"terminal.integrated.defaultProfile.windows": "PowerShell 7",
"terminal.integrated.cursorStyle": "line",
"terminal.integrated.showExitAlert": false,
"terminal.integrated.persistentSessionScrollback": 6000,
"terminal.integrated.allowChords": false,
"terminal.integrated.fontFamily": "Input Mono",
"terminal.integrated.fontSize": 13,
"terminal.integrated.fontWeight": "400",
"terminal.integrated.fontWeightBold": "400",
"terminal.integrated.lineHeight": 1.1,
"terminal.integrated.letterSpacing": 1,
"terminal.integrated.scrollback": 20000,
"terminal.integrated.enablePersistentSessions": false,
The issue still occurs after disabling all extensions.
I also tried deleting C:\Users\futur\.vscode\extensions\ms-vscode.powershell-2024.5.2\modules\PSReadLine
after reading another post about someone having a similar issue, but this didn't fix the problem.
I really can't provide more information on how to reproduce this issue since it's a bit baffling. But I'm sure it has something to do with the shellIntegration.ps1
script that's added to the command line of new terminal instances.
Activity