PowerShell / PowerShellEditorServices

A common platform for PowerShell development support in any editor or application!
MIT License
622 stars 213 forks source link

Update VS Code shell integration script #1982

Closed andyleejordan closed 1 year ago

andyleejordan commented 1 year ago

Updates our embedded copy with changes made upstream, see https://github.com/microsoft/vscode/pull/170516.

Fixes https://github.com/PowerShell/vscode-powershell/issues/4343.

andyleejordan commented 1 year ago

@SeeminglyScience @tyriar I think the change we make from Console::Write to Write-Host -NoNewLine could be shipped upstream, and I'm wondering if we should change:

# Only send the command executed sequence when PSReadLine is loaded, if not shell integration should
# still work thanks to the command line sequence
if (Get-Module -Name PSReadLine) {
    $__VSCodeOriginalPSConsoleHostReadLine = $function:PSConsoleHostReadLine
...
}

to

if (Get-Module -Name PSReadLine -and $Host.Name -ne "Visual Studio Code Host") {
    $__VSCodeOriginalPSConsoleHostReadLine = $function:PSConsoleHostReadLine
...
}

then at least I won't have to change those two things when importing the script, and that gets us closer to somehow doing what I think is the "Right Thing" and getting either PSES or VS Code to load the upstream shell integration script even for PSES Extension Terminals.