mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Prevent fallback to file completion when tab completing type names (#20084)
This commit is contained in:
@@ -1128,7 +1128,7 @@ namespace System.Management.Automation
|
||||
replacementIndex = typeNameToComplete.Extent.StartOffset;
|
||||
replacementLength = typeNameToComplete.Extent.EndOffset - replacementIndex;
|
||||
completionContext.WordToComplete = typeNameToComplete.FullName;
|
||||
result = CompletionCompleters.CompleteType(completionContext);
|
||||
return CompletionCompleters.CompleteType(completionContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2626,6 +2626,12 @@ function MyFunction ($param1, $param2)
|
||||
$res = TabExpansion2 -inputScript 'using module @{'
|
||||
$res.CompletionMatches.CompletionText -join ' ' | Should -BeExactly "GUID MaximumVersion ModuleName ModuleVersion RequiredVersion"
|
||||
}
|
||||
|
||||
It 'Should not fallback to file completion when completing typenames' {
|
||||
$Text = '[abcdefghijklmnopqrstuvwxyz]'
|
||||
$res = TabExpansion2 -inputScript $Text -cursorColumn ($Text.Length - 1)
|
||||
$res.CompletionMatches | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Tab completion tests with remote Runspace" -Tags Feature,RequireAdminOnWindows {
|
||||
|
||||
Reference in New Issue
Block a user