Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6190,6 +6190,11 @@ internal static List<CompletionResult> CompleteHashtableKey(CompletionContext co
if (commandAst != null)
{
var binding = new PseudoParameterBinder().DoPseudoParameterBinding(commandAst, null, null, bindingType: PseudoParameterBinder.BindingType.ArgumentCompletion);
if (binding == null)
{
return null;
}

string parameterName = null;
foreach (var boundArg in binding.BoundArguments)
{
Expand Down
10 changes: 7 additions & 3 deletions src/System.Management.Automation/engine/CommandDiscovery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,15 @@ internal void AddSessionStateCmdletEntryToCache(SessionStateCmdletEntry entry, b
internal CommandProcessorBase LookupCommandProcessor(string commandName,
CommandOrigin commandOrigin, bool? useLocalScope)
{
CommandProcessorBase processor = null;
CommandInfo commandInfo = LookupCommandInfo(commandName, commandOrigin);
CommandProcessorBase processor = LookupCommandProcessor(commandInfo, commandOrigin, useLocalScope, null);

// commandInfo.Name might be different than commandName - restore the original invocation name
processor.Command.MyInvocation.InvocationName = commandName;
if (commandInfo != null)
{
processor = LookupCommandProcessor(commandInfo, commandOrigin, useLocalScope, null);
// commandInfo.Name might be different than commandName - restore the original invocation name
processor.Command.MyInvocation.InvocationName = commandName;
}

return processor;
}
Expand Down
1 change: 1 addition & 0 deletions test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ Describe "TabCompletion" -Tags CI {
@{ inputStr = 'cd "$pshome\Modu"'; expected = "`"$(Join-Path $PSHOME 'Modules')`""; setup = $null }
@{ inputStr = '$PSHOME\System.Management.Au'; expected = Join-Path $PSHOME 'System.Management.Automation.dll'; setup = $null }
@{ inputStr = '"$PSHOME\System.Management.Au"'; expected = "`"$(Join-Path $PSHOME 'System.Management.Automation.dll')`""; setup = $null }
@{ inputStr = '& "$PSHOME\System.Management.Au"'; expected = "`"$(Join-Path $PSHOME 'System.Management.Automation.dll')`""; setup = $null }
## tab completion AST-based tests
@{ inputStr = 'get-date | ForEach-Object { $PSItem.h'; expected = 'Hour'; setup = $null }
@{ inputStr = '$a=gps;$a[0].h'; expected = 'Handle'; setup = $null }
Expand Down