-
Notifications
You must be signed in to change notification settings - Fork 343
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
completion: add branch name completions for fish #3718
Conversation
Cc @bnjmnt4n who made https://gist.github.com/bnjmnt4n/9f47082b8b6e6ed2b2a805a1516090c8. Not necessarily for this PR, but I wonder whether we could test this functionality in some way. For example, there could be a test that checks whether |
Self::Bash => {} | ||
Self::Elvish => {} | ||
Self::Fish => buf.write_all(CUSTOM_FISH_COMPLETIONS).unwrap(), | ||
Self::Nushell => {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor & optional: Perhaps just use _ => {}
syntax?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, I tried that at first. But clippy warns about a single match arm, suggestingif let
instead. Adding an allow annotation would be possible too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if let
is fine too. Or just leave it be (until clippy gets smart enough to demand converting this code to if let as well).
Oh wow, that's so much better. We should just include that instead of my paltry branch completions. I'll be happy to close this PR and let @bnjmnt4n add their completions instead. |
I've made some further tweaks to that script actually, which I hope to update on the Gist soon. It's just that I'm not sure if we want to shift the maintenance of that script into the repo? If it's included in the repo, people's quality expectations are probably higher, and right now the script is kind of cobbled together. As mentioned, testing is likely going to be very difficult (here's fish's own tests for reference: https://github.com/fish-shell/fish-shell/blob/3374692b9113e85c690059ac3def5f4aa190294f/tests/pexpects/complete.py) I'm happy to defer to the opinions of other contributors here. |
Maybe we can find a reasonably simple and robust subset of these possible hand-written completions that can be added upstream? I'd love to see the most recent version of that script. Alternative idea: Add documentation somewhere pointing people to "community-maintained" scripts. There would be no expectation of quality (they may still live in this repo for discoverability). |
Yeah, my script was actually listed in the wiki, which includes other resources as well. Relevant comment: #3711 (comment) |
Great, I wasn't aware of that wiki page. |
Perhaps something closer to https://github.com/fish-shell/fish-shell/blob/3374692b9113e85c690059ac3def5f4aa190294f/tests/checks/git.fish would work. |
I haven't even looked at the script but I'm fine with having an imperfect script merged. It sounds like it would help users. I think users don't have very high expectations from shell completion scripts anyway. And jj is still experimental, so we can replace it by something better (based on clap?) later. What do you (all) think? |
I agree with this. I'm happy to keep working on this PR and get it in good shape if there is agreement about the appropriate scope of completion scripts that are kept upstream. |
Clap's dynamic completion seems still a long way off. Personally, I'm using |
superseded by #4737 |
Checklist
If applicable:
CHANGELOG.md
This is related to #1217, but that issue should probably stay open until someone adds these completions for other shells as well.