Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab completion for command parameters shows invalid candidates #1

Closed
oising opened this issue May 13, 2013 · 5 comments
Closed

Tab completion for command parameters shows invalid candidates #1

oising opened this issue May 13, 2013 · 5 comments

Comments

@oising
Copy link
Contributor

oising commented May 13, 2013

I can't see immediately why this happens, but here's a repro:

# this works, in that -dingtone is not shown as a candidate
set-psreadlineoption -dingtone foo -ding<tab>

# this does not work, in that it shows the parameter repeatedly as a choice
set-psreadlineoption -addtohistoryhandler foo -addtohistory<tab>

A cursory look at parameter metadata yield no clues, sorry!

@oising
Copy link
Contributor Author

oising commented May 13, 2013

Oh, I see that the latter - failing case - has an [AllowNullAttribute] - could that be it?

@lzybkr
Copy link
Member

lzybkr commented May 13, 2013

This is a general PowerShell issue.

As odd as it sounds, it looks like it depends whether or not there are multiple parameters with a common prefix. If there is a common prefix for more than 1 parameter, PowerShell will never suggest an already specified parameter.

If the parameter has a unique prefix, PowerShell will suggest that parameter even if it has been specified.

Try this:

function foo($qqq, $zzz1, $zzz2) {}
foo -qqq 1 -q<TAB>            # will suggest -qqq
foo -zzz1 1 -z<TAB>           # will only suggest -zzz2
foo -zzz1 1 -zzz2 2 -z<TAB>   # will suggest neither -zzz1 nor -zzz2

@lzybkr lzybkr closed this as completed May 13, 2013
@oising
Copy link
Contributor Author

oising commented May 14, 2013

But it's a bug, right? I think you might know the guy who wrote the tab completion stuff, no? :)

@lzybkr
Copy link
Member

lzybkr commented May 15, 2013

I asked the author of that code (no, it wasn't me) and he said it was by design, but I convinced him it was a bad design so he now considers it a bug. Maybe open a bug on Connect?

@oising
Copy link
Contributor Author

oising commented May 15, 2013

Ok, I'll just log it as it stands - I thought you were trying to justify
the behaviour as by-design too. I just presumed I was too sober to
understand and planned on drinking a few glasses of wine and reading your
mail again.

-Oisin

On Wed, May 15, 2013 at 2:10 PM, Jason Shirk [email protected]:

I asked the author of that code (no, it wasn't me) and he said it was by
design, but I convinced him it was a bad design so he now considers it a
bug. Maybe open a bug on Connect?


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-17955905
.


404 signature missing

lzybkr pushed a commit that referenced this issue Jun 5, 2015
@vahagaonakar vahagaonakar mentioned this issue Sep 30, 2021
3 tasks
@Prodigysec Prodigysec mentioned this issue May 11, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants