Skip to content

Commit 35232a7

Browse files
committed
Fix shell integration ps1 script for pwsh 5
Fixes microsoft#227132
1 parent 5b066ec commit 35232a7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ function Set-MappedKeyHandler {
172172

173173
function Get-KeywordCompletionResult(
174174
$Keyword,
175-
$Description = $null
175+
$Description = $Keyword
176176
) {
177-
[System.Management.Automation.CompletionResult]::new($Keyword, $Keyword, [System.Management.Automation.CompletionResultType]::Keyword, $null -ne $Description ? $Description : $Keyword)
177+
[System.Management.Automation.CompletionResult]::new($Keyword, $Keyword, [System.Management.Automation.CompletionResultType]::Keyword, $Description)
178178
}
179179

180180
function Set-MappedKeyHandlers {
@@ -360,7 +360,7 @@ function Send-Completions {
360360
# completions are consistent regardless of where it was requested
361361
elseif ($lastWord -match '[/\\]') {
362362
$lastSlashIndex = $completionPrefix.LastIndexOfAny(@('/', '\'))
363-
if ($lastSlashIndex -ne -1 && $lastSlashIndex -lt $cursorIndex) {
363+
if ($lastSlashIndex -ne -1 -and $lastSlashIndex -lt $cursorIndex) {
364364
$newCursorIndex = $lastSlashIndex + 1
365365
$completionPrefix = $completionPrefix.Substring(0, $newCursorIndex)
366366
$prefixCursorDelta = $cursorIndex - $newCursorIndex
@@ -430,7 +430,7 @@ function Send-Completions {
430430
# completions are consistent regardless of where it was requested
431431
if ($completionPrefix -match '[/\\]') {
432432
$lastSlashIndex = $completionPrefix.LastIndexOfAny(@('/', '\'))
433-
if ($lastSlashIndex -ne -1 && $lastSlashIndex -lt $cursorIndex) {
433+
if ($lastSlashIndex -ne -1 -and $lastSlashIndex -lt $cursorIndex) {
434434
$newCursorIndex = $lastSlashIndex + 1
435435
$completionPrefix = $completionPrefix.Substring(0, $newCursorIndex)
436436
$prefixCursorDelta = $cursorIndex - $newCursorIndex

0 commit comments

Comments
 (0)