-
Notifications
You must be signed in to change notification settings - Fork 389
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: teach bookmark rename about old name #4823
Conversation
For |
Yes, this should already be the case for the "old" argument, which needs to be a bookmark that exists. The "new" argument however shouldn't be completed as an existing branch though, right? That would result in an error. Users will have to provide a brand new name for the "new" argument, so we can't complete it fully. But we can assume that they want to start it with their configured prefix. |
Sorry, I think I skimmed past the code a little too fast. Thanks for pointing this out, I thought this was for completing the existing bookmark name instead of the new bookmark name. |
268e3b3
to
1835332
Compare
I don't think it's good idea to suggest
For "rename" in particular, suggesting old name can be useful. The user might want to fix a typo in it. |
Hm. This suggestion only triggers when the key is actually configured, so not with the default Are there other reasonable ways to use the |
93b2c58
to
74f3988
Compare
Great idea 👍 |
I can think of more situations where it could be valuable for jj to interpret a bookmark prefix as an identifier. Take this section from the docs:
I think in most situations, neither of these are ideal. I usually want only my bookmarks to automatically be tracked. So I can't set this option and I have to track all my bookmarks manually. What if there was an option like this: git.auto-local-bookmark-matching-push-prefix = true That seems much more applicable to the general case. But I don't think we have to stuff these semantics into [git]
push-bookmark-prefix = "push-"
bookmark-identifier-prefix = "remo/"
auto-local-bookmark-with-identifier = true I personally still think these two should be related, because if I set We could also rename the option to clarify the semantics and warn about the deprecated name for a while. |
Yes, but I don't know if people want to use the BTW, it's implementation detail that the default
Maybe auto-local-bookmark can be extend to a string pattern or revset? |
That might be an argument for having two separate config keys, instead of adding the identifying semantics to the existing one. Do you think there is no value whatsoever in completing the identifying prefix of a bookmark for people who configured jj that way?
That also sounds like a good solution. Auto-tracking bookmarks pointing to 'mine()' seems like what people would want most of the time. |
74f3988
to
2f3ae25
Compare
I personally think that way, but I rarely name bookmarks. If people like it, I won't against the decision. (but please add a comment why I think suggesting existing bookmark names is good enough because there would be a few |
I guess you're right, completing the push prefix doesn't really make sense. I'll remove that but keep the completion the old bookmark name for renames. Completing bookmark names other than the old one for renames doesn't make sense to me, I'd rather not do that just to get the prefix completion. |
2f3ae25
to
8b44983
Compare
8b44983
to
9a8da72
Compare
9a8da72
to
7a9a1e6
Compare
.nth(1); | ||
if let Some(bookmark) = bookmark_to_rename { | ||
candidates.push(CompletionCandidate::new(bookmark)); | ||
} |
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.
Isn't it flaky if there are global argument after <OLD_NAME>
for example?
I personally don't think this would be worth the effort. Maybe better to revisit after clap add something like clap-rs/clap#5784?
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.
Yeah, makes sense.
Checklist
If applicable:
CHANGELOG.md