feat: Add custom completer for completing cargo build --packge <TAB>#15338
Closed
nooma-42 wants to merge 3 commits intorust-lang:masterfrom
Closed
feat: Add custom completer for completing cargo build --packge <TAB>#15338nooma-42 wants to merge 3 commits intorust-lang:masterfrom
nooma-42 wants to merge 3 commits intorust-lang:masterfrom
Conversation
…nds during compile time.
…` / `cargo tree --package <TAB>`
Collaborator
|
r? @weihanglo rustbot has assigned @weihanglo. Use |
Collaborator
|
☔ The latest upstream changes made this pull request unmergeable. Please resolve the merge conflicts. |
Contributor
|
In #14553 (comment), I expressed concern over keying off of the name of the command for deciding what kind of completions should be done. |
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 6, 2025
### What does this PR try to resolve? Add dynamic completions for the various `-p <package>` arguments. Fixes #15004 ``` cargo bench|build|check|doc|fix|test -p <tab>` cargo package|publish -p <tab> cargo add|pkgid|remove|report|run|rustc|rustdoc -p <tab> cargo uninstall -p <tab> cargo tree -p <tab> -i <tab> cargo clean -p <tab> # not implemented ``` Supersedes #14553 and #15338 --- EDIT: the second implementation has been chosen In the first commit I implemented the different completions for different usages by splitting the `arg_package` methods into multiple ones if necessary: ``` * arg_package_spec * arg_package_spec_no_all * arg_installed_package_spec_no_all <- new (for cargo uninstall) * arg_dependency_package_spec_no_all <- new (for cargo tree) * arg_clean_package_spec_simple <- new (for cargo clean) * arg_package_spec_simple * arg_package ``` In the second commit I tried to instead pass an `ArgValueCandidates` into the function to prevent that duplication. ``` * arg_package_spec * arg_package_spec_no_all (ArgValueCandidates) * arg_package_spec_simple (ArgValueCandidates) * arg_package ``` I think I have a small preference towards the latter, but no strong opinion.
Contributor
|
This ended up being resolved by #16210. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
Fixes #15004
How should we test and review this PR?
Additional information
This supersedes #14553