Powershell: Native ArgumentCompleter not invoked for inputs that begin with hyphen (-)

Created on 21 Dec 2016  路  6Comments  路  Source: PowerShell/PowerShell

Description

Because of this issue, it's not possible to provide completion for native command parameters.

Inputs that repro the issue for command 'foo' (i.e. do not invoke completion):

  1. foo -\
  2. foo -a\
  3. foo --\

Inputs that do not repro the issue:

  1. foo --a\
  2. foo ---\

The issue repros with and without PSReadLine.

Steps to reproduce

  1. Register a new argument completer
    Register-ArgumentCompleter -Native -CommandName foo -ScriptBlock { "bar" }

  2. Type 'foo -\

Expected behavior

'foo -' completes to 'foo bar'

Actual behavior

The text does not change

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSRemotingProtocolVersion      2.3
CLRVersion
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
GitCommitId                    v6.0.0-alpha.14
PSVersion                      6.0.0-alpha
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSEdition                      Core
BuildVersion                   3.0.0.0
Issue-Bug Resolution-Fixed Up-for-Grabs WG-Interactive-IntelliSense

All 6 comments

Odd - this works with TabExpansionPlusPlus which defines roughly the same command and in theory works in a similar way, but it doesn't work with the built-in cmdlet.

Can somebody apply the "Consider-WindowsPowerShell51" label to this issue? As written in PowerShell/PowerShell-Docs#1979, there is a same issue in Windows PowerShell 5.1.

It seems like that inpus start with - still doen't get any completion now.
Is this issue fixed?

This is still an issue in PowerShell 5.1, it's only been fixed in PowerShell Core. Should this be re-opened for 5.1, or should we create a new issue? @iSazonov

PS 5.1 is not being maintained excepting for critical security issues.

All development/bugfix efforts are focused on PS 7+.

@vexx32 Thanks, I'm sorry to hear that but it's good to know.

Was this page helpful?
0 / 5 - 0 ratings