Skip to content

Tab completion for -Repository parameter fails when input starts with a quote #1968

@tablackburn

Description

@tablackburn

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

  1. Open a PowerShell session with Microsoft.PowerShell.PSResourceGet loaded
  2. Type: Find-PSResource -Repository "PSG
  3. Press Tab to trigger tab completion
  4. Nothing happens — no completion is offered

Same behavior with single quotes:

  1. Type: Find-PSResource -Repository 'PSG
  2. Press Tab — no completion is offered

Without quotes, completion works fine:

  1. Type: Find-PSResource -Repository PSG
  2. Press Tab — completes to PSGallery

Expected behavior

PS> Find-PSResource -Repository "PSG<Tab>
# Completes to: Find-PSResource -Repository "PSGallery"

PS> Find-PSResource -Repository 'PSG<Tab>
# Completes to: Find-PSResource -Repository 'PSGallery'
Tab completion should work regardless of whether the user has started typing with a quote character, and the result should preserve the user's quote style.

Actual behavior

PS> Find-PSResource -Repository "PSG<Tab>
# Nothing happens — no completions returned

PS> Find-PSResource -Repository 'PSG<Tab>
# Nothing happens — no completions returned
The RepositoryNameCompleter fails to produce any matches because the leading quote character is included in the wildcard pattern (e.g., "PSG*), which doesn't match any repository name.

Error details

N/A — no error is thrown; completions are silently empty.

Environment data

PS> Get-Module Microsoft.PowerShell.PSResourceGet -ListAvailable

Name                               Version Path
----                               ------- ----
Microsoft.PowerShell.PSResourceGet 1.2.0   C:\program files\powershell\7\Modules\...

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.6.0
PSEdition                      Core
GitCommitId                    7.6.0
OS                             Microsoft Windows 10.0.26200
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.4
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions