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

feat(complete): Add descriptions to dynamic Zsh completions #5775

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

vivienm
Copy link
Contributor

@vivienm vivienm commented Oct 13, 2024

When using unstable-dynamic completions in Zsh, suggested values are not described. It's a step backwards compared to the default behavior and it makes things more difficult for users.

I had a quick look and it seems relatively easy to fix. But I'm not familiar with either clap or Zsh autocompletion, so I may miss something here.

@vivienm vivienm force-pushed the master branch 4 times, most recently from a95db64 to 334a742 Compare October 13, 2024 20:09
@vivienm
Copy link
Contributor Author

vivienm commented Oct 19, 2024

Also, I had to add this to my zshrc to prevent zsh from changing the order of suggestions:

zstyle ':completion:*:*:my-program:*:*' sort false

Not necessarily a problem, but it could be worth documenting, or maybe write it in the completion script?

@epage
Copy link
Member

epage commented Oct 21, 2024

Not necessarily a problem, but it could be worth documenting, or maybe write it in the completion script?

We generally want things sorted according to our order. We tweaked bash to ensure this. If you know how to do insert this in our script to be respected, please help us out and post a PR for this!

@vivienm
Copy link
Contributor Author

vivienm commented Oct 21, 2024

We generally want things sorted according to our order. We tweaked bash to ensure this. If you know how to do insert this in our script to be respected, please help us out and post a PR for this!

I'll give it a try! (Not in this PR.)

@epage
Copy link
Member

epage commented Oct 24, 2024

FYI the issue for zsh sorting is #5752

@epage epage changed the title chore(complete): Add descriptions to dynamic Zsh completions feat(complete): Add descriptions to dynamic Zsh completions Oct 24, 2024
@epage epage merged commit e95ed39 into clap-rs:master Oct 24, 2024
25 checks passed
@epage
Copy link
Member

epage commented Oct 24, 2024

FYI I would classify this as a feat rather than a chore. I see chores as something not relevant for changelogs (and cargo release changes might even hide them, I can't remeber)

bors added a commit to rust-lang/cargo that referenced this pull request Oct 24, 2024
feat(complete): Include descriptions in zsh

### What does this PR try to resolve?

See clap-rs/clap#5775 for more details

### How should we test and review this PR?

If you're not a zsh user, you may need somthings like this to activate the completion system:

```shell
# See https://zsh.sourceforge.io/Doc/Release/Completion-System.html
autoload -Uz compinit
compinit
# and then source completion scripts
source <(CARGO_COMPLETE=zsh target/debug/cargo)
```

### Additional information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants