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

fish vs carapace in 2024 #2518

Open
ccoVeille opened this issue Aug 22, 2024 · 8 comments
Open

fish vs carapace in 2024 #2518

ccoVeille opened this issue Aug 22, 2024 · 8 comments
Labels
enhancement New feature or request fund Fundable with polar.sh

Comments

@ccoVeille
Copy link

ccoVeille commented Aug 22, 2024

Request

I'm a fish user, and I'm new to caparace

I followed the step describe in https://carapace-sh.github.io/carapace-bin/setup.html

I was surprised to see

carapace --list | awk '{print $1}' | xargs -I{} touch ~/.config/fish/completions/{}.fish # disable auto-loaded completions (#185)

see

I can see the reference here

carapace --list | awk '{print $1}' | xargs -I{} touch ~/.config/fish/completions/{}.fish # disable auto-loaded completions (#185)

I found the code was moved via 6ad36ab and was initially added via 79e988e (via #880)

All these are pretty old, the #185 was mentioning

Is there any progress around this ?

I saw the status of fish-shell#6716 but I was curious if there is nothing else that evolved in the last few years. I find pretty painful to create empty file it's a strange logic

I found this cli/cli#360 (comment)

Proposed solution

I would have expected carapace to:

  • create the empty file via the go, not via an shell rule

  • the empty file could have a better content than simply being empty

they could contain comment about why the file is there and empty

  • use fish "complete -e" can't help ?

  • maybe the fish file could contain the complete command instead of being empty

for example

~/.config/fish/completions/git.fish could contain this

complete -e 'git' 
complete -c 'git' -f -a '(_carapace_lazy git)'

Anything else?

I might be wrong about the things I'm asking or the point I'm raising, but I would like to know if we couldn't do something better for the fish integration

Thanks

Polar

Fund with Polar
@ccoVeille ccoVeille added enhancement New feature or request fund Fundable with polar.sh labels Aug 22, 2024
@rsteube
Copy link
Member

rsteube commented Aug 22, 2024

Well it is only a workaround and I expected fish to fix this fairly quickly (little did I know).

The problem is that this is a bug in fish and from the outside this was the only way to get around it.
Erasing existing completion doesn't work, because fish loads the system completion on first invocation (pressing tab).
It does so even if one is already defined which clutters it.

Shell startup time is critical which limits other potential workarounds.

Generating the files in go is possible, but it is quite an invasive step as it essentially kills the native completion of fish which might be unwarranted when one disables a completer from carapace.

To be honest, this just needs to be fixed in fish with the tombstone approach mentioned here.

@ccoVeille
Copy link
Author

Thanks for your reply. I understand.

Do you think I could quote your reply in the involved fish discussions, and ask them for a status?

@rsteube
Copy link
Member

rsteube commented Aug 22, 2024

Sure

@ccoVeille
Copy link
Author

ccoVeille commented Aug 24, 2024

A fix was provided. Let now wait for it to be released

@azlekov
Copy link

azlekov commented Nov 4, 2024

Hello carapace is adding like 3 seconds to my fish prompt startup and I think is because of these completions. Is there any fix for this?

@rsteube
Copy link
Member

rsteube commented Nov 4, 2024

Hello carapace is adding like 3 seconds to my fish prompt startup and I think is because of these completions. Is there any fix for this?

Even with the workaround it shouldn't be this bad 🤔.
The files in ~/.config/fish/completions just need to be created once for each new completer.
So the workaround doesn't need to be executed every time.

The complete command in fish also tends to be quite slow (which is a bit weird),
if you want the full startup speed you could also export the scripts instead of sourcing carapace.

carapace git fish > ~/.config/fish/completions/git.fish

But you'd need to update PATH and add the set-env/get-env functions manually.

@ccoVeille
Copy link
Author

The point raised by @azlekov is legitimate, and the workrounds you provided could provide a solution.

But @rsteube said a few months ago fish needed to change something in a way to use something called "tombstone"

But the issue is now fixed

fish-shell/fish-shell@5918bca

Shouldn't the solution be now updated as fish should support it.

Please note, I'm aware there is no new fish release since March 2024

@rsteube
Copy link
Member

rsteube commented Nov 4, 2024

Well, depends on how easy it is to install a nightly (and how stable the master is).
But I can add a notice to the instructions, yes.

Might slowly be time to have another look at this.
Invocation delay of carapace is in the range of 7-10ms, which I personally don't consider an issue.
But the slow performance of the complete command and the amount of completers registered due to the bridges makes the whole topic relevant again.

It's possible to have a near zero overhead for most shells, but it involves a slightly different approach (see above).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fund Fundable with polar.sh
Projects
None yet
Development

No branches or pull requests

3 participants