rust-analyzer
rust-analyzer copied to clipboard
Support adding or removing dependencies
panicbit.cargo has some commands to add dependencies, maybe we should add something similar so people don't hate us after #16416.
I got this working:
But it pains me to bring back all that network and proxy stuff so I'm not sure we want it :sweat_smile:.
A question : Although definitely not the same in terms of user experience but am I right in assuming that we will be able to let user add and remove dependencies once we have Cargo.toml support? I expect user type a crate's name an suggestion fetched from "cargo search" populating suggestions.
TIL cargo search. I guess it means we could do this without bringing in the network stuff in the VS Code extension, and even run it server-side?
But yes, it would also be nice to have some kind of completion support. Not sure how triggering them would work, though.
Another way to offer this functionality would be via a fix-it: you type use serde::Serialize, get a diagnostic on serde, choose a quick fix, and a menu pops up with the crate search results. I think we can do that, right?
Well we don't have name resolution diagnostics yet 😅 though for imports they shouldn't be too difficult to implement. Otherwise yes I think so?
Yeah, I was wondering about the UI parts (opening the listbox after choosing the fix). I thought we have an assist that worked like that, but I don't remember which one.
All the grouping assists do that (via an lsp extension iirc)
Hey there! Would love if cargo-edit functionality was implemented in r-a directly!
I'm also happy to deprecate the addon and redirect to r-a!
Can we un-deprecate panicbit.cargo until these commands have been implemented in rust-analyzer?
@panicbit Is there any chance that you might be interested in bringing back your extension until this is supported by rust-analyzer?
I'd be willing to work on releasing a version with cargo check/build functionality removed (leaving only cargo add and cargo rm).
That would be amazing. I am really missing those features specifically (and I never used any other features of the extension).
I have updated the extension, but we'll have to wait until it gets undeprecated again (see request here).
As a temporary workaround, you can download the extension from the marketplace and then drag it into the extension list in vscode: https://marketplace.visualstudio.com/items?itemName=panicbit.cargo
For anyone else looking for a quick work-around: Pasting ext install panicbit.cargo in the Quick Open menu (Ctrl+P) also worked for me.