rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.86k stars 2.43k forks source link

Tracking Issue for native-completion #14520

Open shannmu opened 2 months ago

shannmu commented 2 months ago

Summary

Original issue: #6645 Implementation:

Documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#native-completions

Unresolved Issues

Open Questions

Future Extensions

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.

epage commented 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

epage commented 2 months ago

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

shannmu commented 2 months ago

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.

shannmu commented 1 month ago

Is there any difference in the completion of the --registry option between cargo publish and cargo add?

epage commented 1 month ago

@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.