Skip to content

Tab completion for command parameters shows invalid candidates #1

Closed

Description

@oising

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!

Activity

  1. oising commented on May 13, 2013

    @oising
    ContributorAuthor

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

  2. lzybkr commented on May 13, 2013

    @lzybkr
    Contributor

    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
  3. oising commented on May 14, 2013

    @oising
    ContributorAuthor

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

  4. lzybkr commented on May 15, 2013

    @lzybkr
    Contributor

    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?

  5. oising commented on May 15, 2013

    @oising
    ContributorAuthor

    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 notifications@github.comwrote:

    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

  6. added a commit that references this issue on Jun 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions