From 35232a70bcbcfbe9fe7204a9c2a85af15df061a9 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Thu, 29 Aug 2024 11:06:38 -0700 Subject: [PATCH] Fix shell integration ps1 script for pwsh 5 Fixes #227132 --- .../contrib/terminal/browser/media/shellIntegration.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 index 0be7b8aa985..444df38452d 100644 --- a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 +++ b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 @@ -172,9 +172,9 @@ function Set-MappedKeyHandler { function Get-KeywordCompletionResult( $Keyword, - $Description = $null + $Description = $Keyword ) { - [System.Management.Automation.CompletionResult]::new($Keyword, $Keyword, [System.Management.Automation.CompletionResultType]::Keyword, $null -ne $Description ? $Description : $Keyword) + [System.Management.Automation.CompletionResult]::new($Keyword, $Keyword, [System.Management.Automation.CompletionResultType]::Keyword, $Description) } function Set-MappedKeyHandlers { @@ -360,7 +360,7 @@ function Send-Completions { # completions are consistent regardless of where it was requested elseif ($lastWord -match '[/\\]') { $lastSlashIndex = $completionPrefix.LastIndexOfAny(@('/', '\')) - if ($lastSlashIndex -ne -1 && $lastSlashIndex -lt $cursorIndex) { + if ($lastSlashIndex -ne -1 -and $lastSlashIndex -lt $cursorIndex) { $newCursorIndex = $lastSlashIndex + 1 $completionPrefix = $completionPrefix.Substring(0, $newCursorIndex) $prefixCursorDelta = $cursorIndex - $newCursorIndex @@ -430,7 +430,7 @@ function Send-Completions { # completions are consistent regardless of where it was requested if ($completionPrefix -match '[/\\]') { $lastSlashIndex = $completionPrefix.LastIndexOfAny(@('/', '\')) - if ($lastSlashIndex -ne -1 && $lastSlashIndex -lt $cursorIndex) { + if ($lastSlashIndex -ne -1 -and $lastSlashIndex -lt $cursorIndex) { $newCursorIndex = $lastSlashIndex + 1 $completionPrefix = $completionPrefix.Substring(0, $newCursorIndex) $prefixCursorDelta = $cursorIndex - $newCursorIndex