rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Support adding or removing dependencies

Open lnicola opened this issue 1 year ago • 15 comments
trafficstars

panicbit.cargo has some commands to add dependencies, maybe we should add something similar so people don't hate us after #16416.

lnicola avatar Jan 29 '24 15:01 lnicola

I got this working:

image

image

But it pains me to bring back all that network and proxy stuff so I'm not sure we want it :sweat_smile:.

lnicola avatar Jan 31 '24 19:01 lnicola

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.

alibektas avatar Jan 31 '24 22:01 alibektas

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.

lnicola avatar Feb 01 '24 06:02 lnicola

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?

lnicola avatar Feb 02 '24 06:02 lnicola

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?

Veykril avatar Feb 02 '24 07:02 Veykril

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.

lnicola avatar Feb 02 '24 07:02 lnicola

All the grouping assists do that (via an lsp extension iirc)

Veykril avatar Feb 02 '24 07:02 Veykril

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!

panicbit avatar Feb 12 '24 00:02 panicbit

Can we un-deprecate panicbit.cargo until these commands have been implemented in rust-analyzer?

TethysSvensson avatar Feb 21 '24 19:02 TethysSvensson

@panicbit Is there any chance that you might be interested in bringing back your extension until this is supported by rust-analyzer?

TethysSvensson avatar Jun 19 '24 11:06 TethysSvensson

I'd be willing to work on releasing a version with cargo check/build functionality removed (leaving only cargo add and cargo rm).

panicbit avatar Jun 19 '24 11:06 panicbit

That would be amazing. I am really missing those features specifically (and I never used any other features of the extension).

TethysSvensson avatar Jun 19 '24 12:06 TethysSvensson

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

panicbit avatar Jun 19 '24 13:06 panicbit

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.

TethysSvensson avatar Jun 19 '24 14:06 TethysSvensson