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

Completions Contain Trailing space #1051

Closed
2 of 12 tasks
Karuption opened this issue Nov 2, 2024 · 2 comments · Fixed by #1052
Closed
2 of 12 tasks

Completions Contain Trailing space #1051

Karuption opened this issue Nov 2, 2024 · 2 comments · Fixed by #1052
Labels
bug Something isn't working fund Fundable with polar.sh powershell windows

Comments

@Karuption
Copy link

Karuption commented Nov 2, 2024

Current Behavior

When doing a completion, there is a trailing space.

Expected Behavior

Native completions do not include a space in powershell, even on flag completions. I would expect carapace to be idiomatic with these.

Steps To Reproduce

  1. In windows 10, using Terminal
  2. My $PROFILE:
   Import-Module PSFzf
   Set-PSReadLineKeyHandler -Key Tab -ScriptBlock { Invoke-FzfTabCompletion }

    $env:CARAPACE_BRIDGES = 'zsh,fish,bash,inshellisense' # optional
    carapace _carapace | Out-String | Invoke-Expression
  1. Type gh a <TAB>
  2. Select Alias from the FZF window
  3. Auto completion of gh "alias "

Version

1.0.7

OS

  • Darwin
  • Linux
  • Termux
  • Windows

Shell

  • Bash
  • Elvish
  • Fish
  • Nushell
  • Oil
  • Powershell
  • Xonsh
  • Zsh

Anything else?

I can see that the json generated by carapace gh powershell a has a trailing space in its CompletionText. Since there is a char in the string that needs to be escaped, FZF puts quotes around it for a literal.

The trailing space is visible by doing:

carapace.exe gh powershell a  | ConvertFrom-Json | Select-Object -First 1 -ExpandProperty CompletionText  | Select-String -Pattern .*

This functionality seems like it is intentional, but I am not able to find exactly where in the code (or spec) that this is happening. A configuration option to disable or set the trailing options would be amazing.

Polar

Fund with Polar
@Karuption Karuption added bug Something isn't working fund Fundable with polar.sh labels Nov 2, 2024
@rsteube
Copy link
Member

rsteube commented Nov 3, 2024

Yes, this is an intentional feature for fluent completion and one of the things powershell doesn't do well.
I can understand though how the inconsistency can be disrupting and adding this is fairly easy.

@Karuption
Copy link
Author

Thank you! Looking forward to the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fund Fundable with polar.sh powershell windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants