Skip to content

Commit a23e30b

Browse files
authored
Fix issue with incomplete results when completing paths with wildcards in non-filesystem providers (PowerShell#24757)
1 parent 563892f commit a23e30b

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4869,7 +4869,7 @@ private static List<CompletionResult> GetDefaultProviderResults(
48694869

48704870
if (childNameList.Count == 0)
48714871
{
4872-
return results;
4872+
continue;
48734873
}
48744874

48754875
string basePath = providerPrefix.Length > 0

test/powershell/Host/TabCompletion/BugFix.Tests.ps1

+22
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,28 @@ Describe "Tab completion bug fix" -Tags "CI" {
4343
$result[0].CompletionText | Should -BeExactly '$ErrorActionPreference'
4444
}
4545

46+
It "Issue#24756 - Wildcard completions should not return early due to missing results in one container" -Skip:(!$IsWindows) {
47+
try
48+
{
49+
$keys = New-Item -Path @(
50+
'HKCU:\AB1'
51+
'HKCU:\AB2'
52+
'HKCU:\AB2\Test'
53+
)
54+
55+
$res = TabExpansion2 -inputScript 'Get-ChildItem -Path HKCU:\AB?\'
56+
$res.CompletionMatches.Count | Should -Be 1
57+
$res.CompletionMatches[0].CompletionText | Should -BeExactly "HKCU:\AB2\Test"
58+
}
59+
finally
60+
{
61+
if ($keys)
62+
{
63+
Remove-Item -Path HKCU:\AB? -Recurse -ErrorAction SilentlyContinue
64+
}
65+
}
66+
}
67+
4668
Context "Issue#3416 - 'Select-Object'" {
4769
BeforeAll {
4870
$DatetimeProperties = @((Get-Date).psobject.baseobject.psobject.properties) | Sort-Object -Property Name

0 commit comments

Comments
 (0)