rust-lang / rust-lang/cargo

Tracking Issue for native-completion

Open
#14,520 16 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-cli A-completions C-tracking-issue
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Summary

Original issue: #6645

Documentation: 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

Implementation:

  • #14493
  • Add custom completer for cargo uninstall <TAB> (#14534)
  • Add custom completer for cargo build --bin=<TAB> (#14533)
  • Add custom completer for cargo build --bench=<TAB> (#14532)
  • Add custom completer for cargo build --example=<TAB> (#14531)
  • Add custom completer for cargo test --test=<TAB> (#14548)
  • Add custom completer for cargo update <TAB> (#14552)
  • Add custom completer for cargo build --package=<TAB> (#15004, #16210)
  • Add custom completer for cargo help <TAB> (#14557)
  • Add custom completer for cargo -Z <TAB> (#14536)
  • Add custom completer for cargo build --target=<TAB> (#14535)
  • Add custom completer for cargo +<TAB> to complete toolchain name (#15301)
  • Add custom completer for cargo <TAB> to complete aliases defined in config.toml (#15319)
  • Add custom completer for cargo <TAB> to complete third-party subcommand names (#15961)
  • Completing arguments after an alias
  • Completing arguments after a +<toolchain>
  • Ensure vcs, color, and message format possible values are completed (#15322)
  • Add custom completer for cargo publish --registry=<TAB> (#14656)
  • Add custom completer for cargo add --registry=<TAB> (#14656)
  • Add custom completer for --features (#15309)
  • Add completer for cargo build --manifest-path<TAB> (#15225)
  • Add completer for cargo build --lockfile-path<TAB> (#15238)
  • Add completer for cargo install --path<TAB> (#15266)
  • Add completer for cargo add --path<TAB> (#15288)
  • Registering completions / using completions with +toolchain argument
  • #14545
  • Stabilize support in clap (clap-rs/clap#3166)
Unresolved Issues
  • Some tests are disabled on macOS.
  • Distinguish whether different subcommands require path fallback.
  • Completion candidates generation test code per completer.
Open Questions
  • What should we support?
    • Today, cargo supports bash, zsh
    • Currently, this adds fish, elvish, powershell
    • rustup supports bash, fish, zsh, powershell, elvish
    • Are all of sufficient quality? powershell being the biggest question
Future Extensions
  • Completing arguments for third-party subcommands through delegation
    • Stable Cargo has supported this for both bash and zsh already.
  • Add custom completer for cargo <TAB> to cargo scripts
  • Add custom completer for cargo test <TAB> (blocked on json protocol so we can cache the names of tests)
  • Add custom completer for cargo build --profile=<TAB> (#15308)
  • Add custom completer for cargo tree --format
    • Inside of {, offer each variable with closing } with a description of the variable
    • Outside of {}, offer each variable inside {} with description
  • Should we add custom completer for cargo add <TAB> and cargo install <TAB> using crate.io search API
    • Performance?
    • Information leakage when using a different registry but the completer doesn't know
    • End-point usage
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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the native-completions section of Cargo's unstable documentation and review the unchecked items in this tracking issue, especially completion after aliases or a +toolchain argument and the unresolved macOS and fallback tests. Done means addressing a focused remaining checklist item, linking its implementation or test issue here, and confirming the documented completion behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, fish, powershell, rust, zsh
Domain
cli, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.