Skip to content
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

Support delimited values for native completions #3922

Open
epage opened this issue Jul 13, 2022 · 5 comments
Open

Support delimited values for native completions #3922

epage opened this issue Jul 13, 2022 · 5 comments
Labels
A-builder Area: Builder API A-completion Area: completion generator C-enhancement Category: Raise on the bar on expectations E-help-wanted Call for participation: Help is requested to fix this issue. 💸 $20

Comments

@epage
Copy link
Member

epage commented Jul 13, 2022

See #3166 for more context

@epage epage added C-enhancement Category: Raise on the bar on expectations A-builder Area: Builder API A-completion Area: completion generator labels Jul 13, 2022
@epage epage added 💸 $20 E-help-wanted Call for participation: Help is requested to fix this issue. labels Sep 13, 2022
@epage
Copy link
Member Author

epage commented Aug 16, 2024

@shannmu is there a reason #5602 didn't close this?

@shannmu
Copy link
Contributor

shannmu commented Aug 19, 2024

The issue still seems to be related to allow_hyphen_values, where the completion for the delimited option includes the possible values of positional arguments (if they are also delimited). This is not caused by this issue, but it shows that the issue has not been fully resolved.

@epage
Copy link
Member Author

epage commented Aug 19, 2024

I don't what allow_hyphen_values has to do with value_delimiter. I don't quite understand your explanation. Mind re-phrasing or providing examples?

@shannmu
Copy link
Contributor

shannmu commented Aug 19, 2024

assert_data_eq!(
complete!(cmd, "--delimiter=comma,[TAB]"),
snapbox::str![
"--delimiter=comma,comma
--delimiter=comma,space
--delimiter=comma,tab
--delimiter=comma,a_pos
--delimiter=comma,b_pos
--delimiter=comma,c_pos"
]
);

--delimiter=comma is treated as a delimited positional argument. We complete positional argument without conditions required when the current state is ValueDone, so it will call complete_arg_value.

if let Some(positional) = cmd
.get_positionals()
.find(|p| p.get_index() == Some(pos_index))
{
completions.extend(complete_arg_value(arg.to_value(), positional, current_dir));
}

@epage
Copy link
Member Author

epage commented Aug 19, 2024

@shannmu I had missed that. If there is a known issue in a PR, call it out. That should have been discussed before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-builder Area: Builder API A-completion Area: completion generator C-enhancement Category: Raise on the bar on expectations E-help-wanted Call for participation: Help is requested to fix this issue. 💸 $20
Projects
None yet
Development

No branches or pull requests

2 participants