Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Completions shipped in dir incompatible with fisher 4 #107

Open
ghost opened this issue Mar 27, 2022 · 5 comments
Open

Completions shipped in dir incompatible with fisher 4 #107

ghost opened this issue Mar 27, 2022 · 5 comments

Comments

@ghost
Copy link

ghost commented Mar 27, 2022

I've noticed that the completions tend to behave a little buggy for this plugin. See here for example, screenshot before and after pressing tab:

Screenshot from 2022-03-27 11-24-02

Screenshot from 2022-03-27 11-24-25

I suspect that the reason this is failing is because this plugin when installed with fisher, does not follow fisher's recommendation of shipping completions in a completions dir: https://github.com/jorgebucaran/fisher#creating-a-plugin. Should be simple enough to address, I can create a PR if you want.

I'm using fish 3.4.1, fisher 4.3.1, prompt is hydro, and kitty 0.24.4. Let me know if you need more info.

@krobelus
Copy link
Collaborator

krobelus commented Mar 27, 2022 via email

@ghost
Copy link
Author

ghost commented Apr 1, 2022

In looking through the source, it seems that it's been set up to allow for a variable command name, i.e. you can choose to use j or jo or anything you want instead of z.

That's not compatible with my suggestion of shipping the completions in the completions dir. If we want to do that there should be a fixed command name, because the completions filename should be identical to the command to complete:

Fish automatically searches through any directories in the list variable $fish_complete_path, and any completions defined are automatically loaded when needed. A completion file must have a filename consisting of the name of the command to complete and the suffix .fish.
https://fishshell.com/docs/current/completions.html#where-to-put-completions

My suggestion would be to remove the logic that allows for a variable command name.

  • It duplicates fish's native manner of aliasing a command. Fish functions used for aliasing can be lazy loaded.
  • A fixed command name would allow the completions to be lazy loaded as well, instead of the current conf script that runs each time fish starts.

This is just from a quick look at the code, so let me know what you think of this suggestion.

@krobelus
Copy link
Collaborator

krobelus commented Apr 1, 2022 via email

@ghost
Copy link
Author

ghost commented Apr 8, 2022

PR #108 fixes the bug. The potential solution we've discussed here is not necessary to fix this, but I think simplifying to a fixed command name would still be a good change for fisher compatibility. I'll see if I can create a separate PR for that.

@ghost
Copy link
Author

ghost commented Apr 8, 2022

I'll see if I can create a separate PR for that.

Done, see #109

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant