-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Intentionally control when a space is appended for native completions #5587
Comments
A trailing space designWhat do we support now
Cases where we should append the trailing space
Cases where we should not append the trailing space
Cases that depend on the contextvaluesNote What is the context when completing the values of flag
At the meaning of value level
BTW, when checking the completion for the values of the flag, I found that we might support Open questions
I think that we should not offer every --option=value possible. For example, if the completion of value comes from
I think this question was mentioned above. |
Only the cases of the values is relatively complex and are blocked by other issues. The cases for others are relatively certain. We could get benefit from 67e31af, and add |
Looking forward to your thoughts. Your feedback is really important! |
This isn't a question of the number being matched as The way So this is a distinct case from the others. |
This is a question of framing. When we have Arg::new("option")
.value_name("value")
.value_hint(ValueHint::FileType)
.requires_equals(true) If the user has @ModProg would be good to get your input on this, if possible. |
I think I'd prefer for this to be more descriptive, like |
As mentioned in #5587 (comment), #3921 is not a blocker for this. #3922 is a soft-blocker. We could close this out for what is possible now and push responsibility for that case onto #3922 but I think I'd prefer to track this as a cohesive whole so we focus on what the entire user experience around this is. |
One thing to check is verify which shells actually support different behavior here, e.g., fish won't honer us providing the space or not, but uses a list of characters to decide (fish-shell/fish-shell#7832). The list: In my testing, a trailing slash in the completion was actually escaped: So e.g. for an option that is
We could make this depend on two factors, number of possible values and whether there are other options left.
|
I haven't found a way to handle fish's trailing space yet.
|
I think if we just extend Though it does mean, that for lists in something like fish, it could make sense to offer completions with trailing commas? Either exclusively or both, producing both should probably also be limited to when there aren't too many completions on screen. Either |
Looks like we just do a basic clap/clap_builder/src/parser/parser.rs Lines 1164 to 1166 in 5efa52a
|
See #5576 (comment)
|
so if we go the route of using trailing Though this would technically be a breaking change as I'd expect |
A trailing space signifies that there is nothing else to complete for this argument and the next argument should be started.
Cases where a space is appropriate
Cases where a space is not appropriate
=
Open questions
--opt
completing for--option=value
, instead of completing to--option
should we offer every--option=value
possible?--option value
as well?--option=value
or--option value
? (requires_equals
is a time when there isn't a choice)num_args
), should we offer with space and without?Note: we might be able to defer some of these open questions as "parity with stable, static
clap_complete
" is the minimum barThe text was updated successfully, but these errors were encountered: