Skip to content
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

Cargo add/Cargo install + tab should list all available crates #13043

Closed
dev-ardi opened this issue Nov 24, 2023 · 7 comments
Closed

Cargo add/Cargo install + tab should list all available crates #13043

dev-ardi opened this issue Nov 24, 2023 · 7 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@dev-ardi
Copy link

dev-ardi commented Nov 24, 2023

Problem

cargo add ser + tab takes a while. I think that it's doing a network request every time.

Proposed Solution

Download a list of all crates.

Notes

I would like to try this if I could get some mentoring!

@dev-ardi dev-ardi added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Nov 24, 2023
@dev-ardi
Copy link
Author

If you're confused, you should be. This is not a cargo feature, it's a fish feature!
https://github.com/fish-shell/fish-shell/blob/master/share/completions/cargo.fish#L39
Anyways, I think it would be cool to have this in cargo

@dev-ardi dev-ardi changed the title Make crate autocomplete faster Cargo add/Cargo install + tab should list all available crates Nov 24, 2023
@epage
Copy link
Contributor

epage commented Nov 24, 2023

FYI there is no list of packages names for a registry at this time.

Itd also help if complete reproduction steps were given including what shell and shell version.

@weihanglo weihanglo added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels Nov 24, 2023
@weihanglo
Copy link
Member

Not sure how it would work for cargo to get this built-in as shell completion, since it is a shell's stuff.

@dev-ardi
Copy link
Author

dev-ardi commented Nov 24, 2023

there is no list of packages names for a registry at this time

Would that be hard to implement?

Itd also help if complete reproduction steps were given including

  1. type cargo install cargo-
  2. Press tab
  3. Fish will call cargo search and display a list of results:
    image

what shell and shell version.

fish, version 3.6.1

@epage
Copy link
Contributor

epage commented Nov 24, 2023

We don't provide completions for fish. Those are provided by the fish community.

@dev-ardi
Copy link
Author

Okay. In order to speed this up for fish it would still be nice to download a list all packages. How hard would this be? I have no idea about how cargo works but it seems like a really simple database query!

@epage
Copy link
Contributor

epage commented Nov 25, 2023

If you'd like fish's completions improved, please open an issue over there. If the fish maintainers want something from us, the request should come from them. If they do, we can then work with them on requirements to make sure a solution delivers what they can use, rather than us all speculating..

Note that this is beyond the capabilities of our first-party completion support. I suspect that fish is parsing human-focused output that is subject to change.

How hard would this be? I have no idea about how cargo works but it seems like a really simple database query!

There is no database for us to query. The big issues are

  • A performant way of downloading and updating the names of the 131,977 packages on crates.io
  • A stable API to expose this information

Related

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

3 participants