-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Feature Request: add suggestion for similarly named features with cargo add
#15436
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
Comments
I'd also love to work on this if the issue gets accepted. Thanks! |
Good idea! The error is at https://github.com/rust-lang/cargo/blob/master/src/cargo/ops/cargo_add/mod.rs#L161 The helper for generating the message is at https://github.com/rust-lang/cargo/blob/master/src/cargo/util/edit_distance.rs#L112 |
Also, be sure to read https://doc.crates.io/contrib/process/working-on-cargo.html#submitting-a-pull-request |
@rustbot claim |
Do you think that |
My first thought is "what would rustc do?". In general, we are moving towards better aligning ourselves with rustc. I feel like the scale for the number of misspelled features within one invocation is likely small (0-2) that it shouldn't be much of a problem in the common cases. |
Alright, thanks! I've implemented the feature though one thing lacks: coloring of the |
Currently, we've not been doing that. When the next version of |
Problem
When adding a crate with certain features and misspelling one of them,
cargo
doesn't suggest features with similar names. This may be confusing if a crate has lots of features. For example:Proposed Solution
Instead of just listing all feature flags,
cargo
may additionally search for similarly named features and suggest them, so that it looks like the following:The help output here is worded the same way the compiler does
Notes
No response
The text was updated successfully, but these errors were encountered: