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 autocomplete deletes argument if not finished with the Loading... state. #283

Open
SpBills opened this issue Nov 7, 2024 · 4 comments

Comments

@SpBills
Copy link

SpBills commented Nov 7, 2024

image

If I hit enter in the following state, it deletes the entire argument. I.E. if I was autocompleting cd abc/123/ it would replace the entire line with just cd.

image

However, once I wait for the following state I can successfully hit enter.

image

@kelleyma49
Copy link
Owner

@SpBills , can you give me more information? I can't see to recreate the issue. See my screen recording below.

TabCompletionTest

Before you run the tab completion, execute $error.Clear() and then run $error and share the contents, if any

@SpBills
Copy link
Author

SpBills commented Nov 15, 2024

@kelleyma49 Okay, so I have been working with it a little more.

Turns out my solution of waiting a little does NOT fix the problem. It was confirmation bias. Weirdly enough, sometimes whenever I hit enter it just erases the entire argument I am autocompleting.

Would you mind sharing the relevant part of your config for tab completion? Thanks!

@kelleyma49
Copy link
Owner

Here's the lines from my config file:

Import-Module PSFzf
Set-PsFzfOption `
    -TabExpansion `
    -PSReadlineChordProvider 'Ctrl+t' `
    -PSReadlineChordReverseHistory 'Ctrl+r' `
    -PSReadlineChordReverseHistoryArgs 'Alt+a' `
    -EnableAliasFuzzyEdit `
    -EnableAliasFuzzyFasd `
    -EnableAliasFuzzyHistory `
    -EnableAliasFuzzyKillProcess `
    -EnableAliasFuzzySetLocation `
    -EnableAliasFuzzyZLocation `
    -EnableAliasFuzzyGitStatus `
    -EnableAliasFuzzySetEverything `
    -GitKeyBindings #`
    #-EnableFd

Set-PSReadLineKeyHandler -Key Tab -ScriptBlock { Invoke-FzfTabCompletion }

@SpBills
Copy link
Author

SpBills commented Nov 21, 2024

An update here. I went ahead and updated and am getting a new error. It's definitely failing a whole lot less tho.

2.6.7 (current version)

C:\Git\xyz> cd An exception occurred in custom key handler, see $error for more information: Cannot bind argument to parameter 'Path' because it is an empty string.
C:\Git\xyz> $error
Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At C:\Program Files\WindowsPowerShell\Modules\PSFzf\2.6.7\PSFzf.psm1:2307 char:23
+         if (Test-Path "$resultTrimmed"  -PathType Container) {
+                       ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.TestPathCommand

Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At C:\Program Files\WindowsPowerShell\Modules\PSFzf\2.6.7\PSFzf.psm1:2307 char:23
+         if (Test-Path "$resultTrimmed"  -PathType Container) {
+                       ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.TestPathCommand

Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At C:\Program Files\WindowsPowerShell\Modules\PSFzf\2.6.7\PSFzf.psm1:2307 char:23
+         if (Test-Path "$resultTrimmed"  -PathType Container) {
+                       ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.TestPathCommand

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