-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Tracking Issue for native-completion #14520
Comments
feat: Add native comlpetion with CompleteEnv under the nightly ### What does this PR try to resolve? Related issue #6645 Tracking issue #14520 This PR is the first step to move cargo shell completions to native completions by using `clap_complete` crate. It makes users could complete cargo subcommand and flags. By using `clap_complete` crate, we could extend the supported shells to Bash, Zsh, Elvish, Fish, and PowerShell. However, at the current stage, the support for PowerShell in `clap_complete` is not fully developed. See clap-rs/clap#3166 to get more context about what features `clap_complete` has supported. ### How to test and review this PR? 1. Build a test environment, including the necessary short completion scripts, and the `complete` function to start an interactive shell with the help of a pty device and obtain completion results. 2. Simply test the completion results of subcommands in bash, zsh, fish, elvish.
feat: Add custom completer for `cargo -Z <TAB>` ### What does this PR try to resolve? Tracking issue #14520 Add custom completer for `cargo -Z <TAB>`
feat: Add custom completer for completing bin names ### What does this PR try to resolve? Tracking issue #14520 Add custom completer for `cargo build --bin=<TAB>`
feat: Add custom completer for completing installed binaries ### What does this PR try to resolve? Tracking issue #14520 Add custom completer for `cargo uninstall <TAB>`
feat: Add custom completer for `cargo -Z <TAB>` ### What does this PR try to resolve? Tracking issue #14520 Add custom completer for `cargo -Z <TAB>`
feat: Add custom completer for completing target triple ### What does this PR try to resolve? Tracking issue #14520 Add custom completer for `cargo build --target=<TAB>`
feat: Add custom completer for completing test names ### What does this PR try to resolve? Tracking issue #14520 Add custom completer for `cargo test --test <TAB>`
feat: Add custom completer for completing benchmark names ### What does this PR try to resolve? Tracking issue #14520 Add custom completer for `cargo build --bench=<TAB>`
@shannmu in testing this, some of the output isn't ideal. The new completer is respecting the documented behavior in We'll need to identify places to sprinkle |
Fish does a lot of parsing of Cargo output and people doing that is a reason we're careful about changing our output. It would be good to see if we could be feature parity with them and get them to switch to our completion generation. Looking over what they do in addition to things specified
See https://github.com/fish-shell/fish-shell/blob/master/share/completions/cargo.fish |
The file paths fallback does indeed affect the user experience. I was thinking if we could temporarily document this issue in the tracking issue. Once the main logic of the various completers is resolved, we can revisit and determine in which cases we don't need the file paths fallback and in which cases it is necessary. |
feat: Add custom completer for `cargo help <TAB>` ### What does this PR try to resolve? Tracking issue #14520 Add custom completer for `cargo help <TAB>` ### Additional information The current completer function is quite slow because it executes too many functions. One idea I have is to use the file!() macro to list the filenames under the commands directory, excluding mod.rs, and return them as the completion results. Would this approach be too hacky?
feat: Add custom completer for `cargo build --example=<TAB>` ### What does this PR try to resolve? Tracking issue #14520 Add custom completer for `cargo build --example=<TAB>`
feat: Add custom completer for `cargo help <TAB>` ### What does this PR try to resolve? Tracking issue #14520 Add custom completer for `cargo help <TAB>` ### Additional information The current completer function is quite slow because it executes too many functions. One idea I have is to use the file!() macro to list the filenames under the commands directory, excluding mod.rs, and return them as the completion results. Would this approach be too hacky?
feat: Add support for completing `cargo update <TAB>` ### What does this PR try to resolve? Tracking issue #14520 Add custom completer for `cargo update <TAB>`
Is there any difference in the completion of the |
@shannmu Both are defined as coming from config, so they should be the same. |
…page feat: Add custom completer for completing registry name ### What does this PR try to resolve? Tracking issue #14520 Add custom completer for completing `cargo publish --registry <TAB>` and `cargo add --registry <TAB>`.
Summary
Original issue: #6645
Implementation:
cargo uninstall <TAB>
(feat: Add custom completer for completing installed binaries #14534)cargo build --bin=<TAB>
(feat: Add custom completer for completing bin names #14533)cargo build --bench=<TAB>
(feat: Add custom completer for completing benchmark names #14532)cargo build --example=<TAB>
(feat: Add custom completer forcargo build --example=<TAB>
#14531)cargo test --test=<TAB>
(feat: Add custom completer for completing test names #14548)cargo update <TAB>
(feat: Add support for completingcargo update <TAB>
#14552)cargo build --package=<TAB>
(feat: Add custom completer for completingcargo build --packge <TAB>
#14553)cargo help <TAB>
(feat: Add custom completer forcargo help <TAB>
#14557)cargo -Z <TAB>
(feat: Add custom completer forcargo -Z <TAB>
#14536)cargo build --target=<TAB>
(feat: Add custom completer for completing target triple #14535)cargo +<TAB>
to complete toolchain namecargo <TAB>
to complete aliases defined inconfig.toml
cargo <TAB>
to complete third-party subcommand namescargo publish --registry=<TAB>
(feat: Add custom completer for completing registry name #14656)cargo add --registry=<TAB>
(feat: Add custom completer for completing registry name #14656)--features
cargo add <TAB>
andcargo install <TAB>
using crate.io search API+toolchain
argumentDocumentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#native-completions
Testing instructions: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#native-completions
Unresolved Issues
Open Questions
bash
,zsh
fish
,elvish
,powershell
bash
,fish
,zsh
,powershell
,elvish
Future Extensions
cargo <TAB>
to cargo scriptscargo builder --manifest-path<TAB>
cargo test <TAB>
cargo --explain=<TAB>
cargo builder --features=<TAB>
cargo builder --profile=<TAB>
cargo install --path<TAB>
cargo add --path<TAB>
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
The text was updated successfully, but these errors were encountered: