PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

Tab complete does not discover multiple overloaded cmdlet/function names

Open brwilkinson opened this issue 7 years ago • 4 comments

Tab complete does not discover multiple overloaded cmdlet names

Environment data

PS version: 5.1.17704.1000 PSReadline version: 2.0.0-beta2 os: 10.0.17704.1000 (WinBuild.160101.0800) PS file version: 10.0.17704.1000 (WinBuild.160101.0800)

Steps to reproduce or exception report

# tab completion find the Cmdlet from Microsoft.PowerShell.Utility
Get-Dat<tab>
Get-Date

# create function with the same name
function get-date {echo foo}

# tab complete finds the function only.
get-dat<tab>
get-date

# pressing tab multiple times does not find the original cmdlet
get-date<tab> 
# nothing happens

# Expected behavior

rmo psreadline
get-date<tab>
get-date<tab>
Microsoft.PowerShell.Utility\Get-Date

Note: Microsoft.PowerShell.Utility\Get-Date is not discoverable when psreadline module is loaded.

brwilkinson avatar Jul 04 '18 22:07 brwilkinson

Thanks for the report.

This is more or less intentional, but maybe needs some refinement.

Right now apparent duplicates are being filtered. I say apparent because we're using the menu text to filter duplicates even though the completion text is different.

This does provide a better experience with bash style completion despite excluding correct possibilities. Most of the time you want the item where the menu text and actual completion match.

That said, with the Windows tab experience, this filtering isn't necessary and it wouldn't be hard to fix for that scenario and keep the menu completion experience as it is right now.

lzybkr avatar Jul 11 '18 21:07 lzybkr

@daxian-dbw any interest in making a code change for EditMode windows?

brwilkinson avatar Oct 28 '21 23:10 brwilkinson

Checked and above steps still happen as described in 7.3.9 and PSRL 2.3.4, this one is tricky because my initial reaction is that the capitalization is the only differentiating factor here and technically running get-date without the function runs Get-Date. I wonder if theres some way we can indicate which one is being selected if we tab through both.

StevenBucher98 avatar Nov 06 '23 18:11 StevenBucher98

Hi @StevenBucher98 Thank you for the follow up.

The behavior in WMF (ps v5.1) or without psreadline loaded, is to expand and then alternate between the fully qualified module path/command name.

Rmo psreadline Then test.

brwilkinson avatar Nov 07 '23 06:11 brwilkinson