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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vivienm
Copy link

@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
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?

Comment on lines 419 to 422
/// Escape help string
fn escape_help(string: &str) -> String {
string.replace('\\', "\\\\")
}

/// Escape value string
fn escape_value(string: &str) -> String {
string.replace('\\', "\\\\").replace(':', "\\:")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you swap these? Values are generally listed in our code and in the zsh output before help, so by switching the order, people will have a smoother time reading this

(I was confused at first and had to double check what I was reading)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I've swapped escape_help and escape_value methods.

@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
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.)

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