Change:
# TODO: There are probably better serializable strings to use # TODO: This doesn't work for empty commands of ^C # TODO: Check ID against last to see if no command ran <del> $Result += $(Get-History -Count 1).CommandLine.Replace("`n", "<LF>").Replace(";", "<CL>") $Result += "`u{7}" </del> <ins> $CommandLine = $(Get-History -Count 1).CommandLine ?? "" $Result += $CommandLine.Replace("`n", "<LF>").Replace(";", "<CL>") $Result += "`a" </ins> # Command finished exit code # OSC 133 ; D ; <ExitCode> ST <del> $Result += "`e]133;D;$(__VSCode-Get-LastExitCode)`u{7}" </del> <ins> $Result += "`e]133;D;$(__VSCode-Get-LastExitCode)`a" </ins> # Prompt started # OSC 133 ; A ST <del> $Result += "`e]133;A`u{7}" </del> <ins> $Result += "`e]133;A`a" </ins> # Current working directory # OSC 1337 ; CurrentDir=<CurrentDir> ST <del> $Result += "`e]1337;CurrentDir=$(Get-Location)`u{7}" </del> <ins> $Result += if($pwd.Provider.Name -eq 'FileSystem'){"`e]1337;CurrentDir=$($pwd.ProviderPath)`a"} </ins> # Write original prompt <del> $Result += Invoke-Command -ScriptBlock $Global:__VSCodeOriginalPrompt </del> <ins> $Result += $Global:__VSCodeOriginalPrompt.Invoke() </ins> # Write command started <del> $Result += "`e]133;B`u{7}" return $Result </del> <ins> $Result += "`e]133;B`a" return $Result </ins> } # TODO: Gracefully fallback when PSReadLine is not loaded function Global:PSConsoleHostReadLine { <del> [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine($Host.Runspace, $ExecutionContext) # Write command executed sequence directly to Console to avoid the new line from Write-Host [Console]::Write("`e]133;C`u{7}") </del> <ins> [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine($Host.Runspace, $ExecutionContext) # Write command executed sequence directly to Console to avoid the new line from Write-Host [Console]::Write("`e]133;C`u{7}") </ins> } # Set IsWindows property <del> Write-Output "`e]633;P;IsWindows=$($IsWindows)`u{7}" Write-Host "`e[1mShell integration activated!" -ForegroundColor Green -NoNewline </del> <ins> [Console]::Write("`e]633;P;IsWindows=$($IsWindows)`a") Write-Host "`e[1mShell integration activated!" -ForegroundColor Green </ins>

Discussion:
I have a profile for PowerShell using the and once I enable the the prompt is no longer loading. With it enabled I see this prompt: ! When I disable I get my expected prompt: ! My prompt function within my PowerShell profile:
this is happening because line is throwing because there is no history in a newly created session
champion , should be able to handle this early next week
i could do a pr
also, here you should use and check if the CWD is a filesystem path. like:
that would be awesome! I'm fairly new to pwsh so any comments on the rest of the script would be appreciated too
Under what cases would the file system not be available?
the provider could be something other than filesystem, like the registry, certificate or environment you can see them if you run
just tried , neat
We probably want to keep the CWD even on non-filesystem providers actually, just give it a different scheme or something in that case to let VS Code differentiate it from a regular path. That way we would still get the cwd folder showing up in the tab: !
also, is it only supposed to support powershell 7 and not win PS?
Yep, no windows powershell
does vscode also supports osc 9;9 for CWD Tracking like win term?
some discussion on the topic in , my plan is to move us over to using our own custom sequences to avoid shell integration getting confused and give us freedom to change what them as we please.
let me know if I'm missing something though, I don't think running another terminal's shell integration script is particularly useful. Instead, you would use the arg injection or set it up manually (docs aren't written yet).
I see you have the sequences we support in your profile, these would break when we action as we'd probably move to use
yeah, I will probably remove them after the chages in and get into a release
Good to hear, let us know if you hit any other problems as I have a pretty simple pwsh setup
Can confirm latest build resolves this now on Inisiders: !