Open shannmu opened 2 months ago
@shannmu in testing this, some of the output isn't ideal. The new completer is respecting the documented behavior in ValueHint::Unknown
which means there are cases like cargo add [TAB]
that show file paths when we shouldn't. On the other hand, this is a good default for cargo install --path [TAB]
.
We'll need to identify places to sprinkle ValueHint::Other
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
--features
cargo add
and cargo install
complete using the crates.io search API
See https://github.com/fish-shell/fish-shell/blob/master/share/completions/cargo.fish
We'll need to identify places to sprinkle
ValueHint::Other
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.
Is there any difference in the completion of the --registry
option between cargo publish
and cargo add
?
@shannmu cargo add
corresponds to https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies-from-other-registries while cargo publish --registry
is https://doc.rust-lang.org/cargo/commands/cargo-publish.html#publish-options
Both are defined as coming from config, so they should be the same.
Summary
Original issue: #6645 Implementation:
cargo uninstall <TAB>
(#14534)cargo build --bin=<TAB>
(#14533)cargo build --bench=<TAB>
(#14532)cargo build --example=<TAB>
(#14531)cargo test --test=<TAB>
(#14548)cargo update <TAB>
(#14552)cargo build --package=<TAB>
(#14553)cargo help <TAB>
(#14557)cargo -Z <TAB>
(#14536)cargo build --target=<TAB>
(#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>
(#14656)cargo add --registry=<TAB>
(#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
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.