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
Add completions to some git stash sub-commands #1216
Conversation
@@ -51,7 +51,7 @@ end | |||
|
|||
function __fish_git_using_command | |||
set cmd (commandline -opc) | |||
if [ (count $cmd) -gt 1 ] | |||
if [ (count $cmd) -eq 2 ] |
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.
This change breaks completion for (e.g.) git rebase
with more than one branch as an argument.
I think you'd be better off leaving this alone, and instead using __fish_git_using_command stash; and __fish_git_stash_using_command apply
.
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.
Oops! Reverted this change.
Issue fish-shell#1102: For some git stash commands, we need to dynamically provide the stash IDs of the saved stashes as completions. This commit provides support for the apply, branch, drop, pop and show stash sub-commands.
This is almost there, but now I still get completions e.g for 'list' when I have already typed It would also be useful to make the stash description the name of the stash. |
I was away on vacation so could not test this. Yes, I too see this behavior when testing with the latest commits from 3 weeks back. However, today after updating with the latest master, the completion has stopped working altogether. It only works if at least 1 character is typed and then too as you noticed, it's showing more options than expected. I'm looking into it right now. I'll look into providing the stash desc as it's name. I'm guessing you want the description to be shown where currently we just write 'Stash', correct? (the name still remains stash@{0} etc) |
I tried a build of a clean upstream master (w/o any of my changes) and there too I see the problem where $ git stash [press tab] It looks like a breakage as previously this functionality was working. I tried using I have a feeling its related to the _parse tree_ rework that ridiculous fish is doing (but I could be completely wrong here), as that's where |
Yes, but what you most likely see is the code that wasn't in master to begin with, but appeared after merge. |
It should be fixed with #1261. |
Ok, I'll wait for #1261 to get merged. In the meantime I'll get the listing of stash desc alongwith the ID/name working. One question here. Should we elide the desc text if it's too long (append "...") ? |
I just checked and it seems that we cannot give a separate description string for each suggestion (args to |
Dynamically-generated completions can set the description for a completion by outputting |
Also, fish automatically truncates long descriptions; there's no need to do it manually. |
Issue fish-shell#1102: Addressed review comments. Now we are also listing the per-stash description alongwith with stash ref log IDs.
Thanks for pointing that out David. I've changed the suggestion function in As to truncating of the desc, I had a decently long text in one of the stash descriptions which was not elided (exact desc: I'll wait for #1261 to get merged and test out my changes again with it. |
That's been merged, so give it another go. The truncation happens dynamically based on window size and number of columns in the completions. |
I updated my branch to the latest from master and got the changes for #1261. There are 2 issues:
If you have time, can you try it on your setup too? Thanks. |
David, did you get a chance to try out the tab completion problem I mentioned in (2) above? |
Issue fish-shell#1102: Addressed review comments. Fixed issue where other subcommands were being suggested alongwith the stash IDs.
Yes, this looks like a regression; see #1282. |
David, I've tested my changes with new pager (by setting |
return 0 | ||
end | ||
|
||
function __fish_git_stashs_and_desc |
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.
style point: this function would be better off as __fish_git_complete_stashes
.
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.
Done.
Issue fish-shell#1102: Addressed review comments
This still doesn't work for me, but I'm not sure why. When I type |
Whoops, my standard completions were still getting loaded. Works beautifully. Thanks for your patience and your contribution! Merged with squash and rebase here: |
Thanks David. I'm just glad I could help. I love fish! :) |
Issue #1102: For some git stash commands, we need to dynamically
provide the stash IDs of the saved stashes as completions.
This commit provides support for the apply, branch, drop, pop and
show stash sub-commands.