Skip to content

Provide the tab-completions of an alias' target command on the alias itself also when targeting native programs #21609

Open
@mklement0

Description

@mklement0

Summary of the new feature / enhancement

An alias sensibly sees the same tab-completions as its target command, but, unfortunately and unexpectedly, only if the alias target is a PowerShell commands, and not also for external (native) programs.

  • For instance, defining Set-Alias gdt Get-Date makes Get-Date's tab-completions available on gdt calls too.

  • By contrast, say you've used Register-ArgumentCompleter to define completions for pwsh, and you've also defined Set-Alias psh pwsh; currently, psh unexpectedly does not use the tab-completions defined for pwsh.

This asymmetry should be fixed.

A minimal example:

# Define dummy completions for `pwsh`
Register-ArgumentCompleter -Native -CommandName pwsh -ScriptBlock { '-foo', '-bar' }

# Make `psh` an alias of `pwsh
Set-Alias psh pwsh  

psh - # pressing TAB right after the "-"  does NOT offer the -foo and -bar completions.

Proposed technical implementation details (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions