Skip to content

Commit 64b6f08

Browse files
authored
Merge pull request microsoft#258791 from microsoft/tyriar/258666
Fix basic SI when PSReadLine isn't loaded
2 parents 32f9b3f + 21ad838 commit 64b6f08

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function Global:Prompt() {
8888
$Result = ""
8989
# Skip finishing the command if the first command has not yet started or an execution has not
9090
# yet begun
91-
if ($Global:__VSCodeState.LastHistoryId -ne -1 -and $Global:__VSCodeState.IsInExecution -eq $true) {
91+
if ($Global:__VSCodeState.LastHistoryId -ne -1 -and ($Global:__VSCodeState.HasPSReadLine -eq $false -or $Global:__VSCodeState.IsInExecution -eq $true)) {
9292
$Global:__VSCodeState.IsInExecution = $false
9393
if ($LastHistoryEntry.Id -eq $Global:__VSCodeState.LastHistoryId) {
9494
# Don't provide a command line or exit code if there was no history entry (eg. ctrl+c, enter on no command)
@@ -153,7 +153,9 @@ elseif ((Test-Path variable:global:GitPromptSettings) -and $Global:GitPromptSett
153153

154154
# Only send the command executed sequence when PSReadLine is loaded, if not shell integration should
155155
# still work thanks to the command line sequence
156+
$Global:__VSCodeState.HasPSReadLine = $false
156157
if (Get-Module -Name PSReadLine) {
158+
$Global:__VSCodeState.HasPSReadLine = $true
157159
[Console]::Write("$([char]0x1b)]633;P;HasRichCommandDetection=True`a")
158160

159161
$Global:__VSCodeState.OriginalPSConsoleHostReadLine = $function:PSConsoleHostReadLine

0 commit comments

Comments
 (0)