Skip to content

Directory completions incorrectly quoted #358

@cspotcode

Description

@cspotcode

Setup

In this example, I type ./ and then trigger Invoke-FzfTabCompletion via hotkey:

Image
PS G: \dev> ./
> 21/21
& '.\@ajeetdsouza'
& '.\@casey'
& '.\@cspotcode'

Bug

I choose the second option and press enter:

Image
PS G:\dev> "& '.\@casey'"

PSFzf erroneously wraps the response in double-quotes. The completion entry already has the appropriate quotes along with the & prefix.

Commentary

PowerShell is recognizing when the path includes special characters and needs to be quoted. It also understands that, since this completion item is in the first position, it must be a command to execute, so we need the leading &.

Here are the raw completion entries from PowerShell:

Image
> (TabExpansion2 ./).completionmatches

CompletionText                  ListItemText                         ResultType ToolTip
--------------                  ------------                         ---------- -------
& './@ajeetdsouza'              @ajeetdsouza                  ProviderContainer G:\dev\@ajeetdsouza
& './@casey'                    @casey                        ProviderContainer G:\dev\@casey
& './@cspotcode'                @cspotcode                    ProviderContainer G:\dev\@cspotcode

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions