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

Rust doesnt give auto complete

Open Milo123459 opened this issue 5 years ago • 20 comments

I'm not getting any autocomplete in my files. I initiated the project with cargo init. Any ideas?

Milo123459 avatar Oct 28 '20 07:10 Milo123459

same problem, no autocomplete at all.

v0.7.8 of the extension.

SylvainMartel avatar Oct 31 '20 17:10 SylvainMartel

I ran into the same issue. I was able to partially fix this by following the instructions in this issue: https://github.com/rust-lang/vscode-rust/issues/637. The fix is to switch the engine to use feature-analyzer and also change the feature-analyzer release tag to 2020-08-31.

jsermeno avatar Nov 01 '20 03:11 jsermeno

Same problem here. I just ran rustup update and now there's no auto-completion.

Twaha-Rahman avatar Nov 01 '20 07:11 Twaha-Rahman

@jsermeno just for the record, the stand-alone matklad.rust-analyzer extension is regularly updated, while the rust-analyzer support in vscode-rust might be somewhat outdated and buggy.

lnicola avatar Nov 01 '20 07:11 lnicola

yeah, I had to uninstall the vscode-rust extension and install matklad.rust-analyzer to get a working autocompletion.
vscode-rust + rls or rust-analyzer wasn'T working.

Is there informations somewhere about what we should install officially? It's pretty confusing right now.

SylvainMartel avatar Nov 01 '20 12:11 SylvainMartel

@kinwolfqc you can install the one you prefer. RLS and vscode-rust are still the "official" solution, but the plan is to transition to rust-analyzer at some point in the future. RFC 2912 and https://rust-analyzer.github.io/blog/2020/04/20/first-release.html have more details.

In the meanwhile, rust-analyzer is probably more actively developed, but https://www.rust-lang.org/ still recommends RLS without any mention of the former.

lnicola avatar Nov 01 '20 12:11 lnicola

I've seen this today, and I fixed it by rolling back to rust 1.46. With 1.47 the autocomplete is broken. Rolling back to rust 1.46 fixed this entirely.

I've been using a VSCode devcontainer for this. The VSCode dev container definition simply grabs the "latest" version of Rust. I happened to have an older container where autocomplete worked, and a newer one where it didn't. By taking my new project, pinning the rust version to 1.46. and rebuilding my container, I had full autocomplete again.

Rust 1.47 was release very recently. The Rust extension is 5 months old.

martinpeck avatar Nov 02 '20 16:11 martinpeck

I've seen this today, and I fixed it by rolling back to rust 1.46. With 1.47 the autocomplete is broken. Rolling back to rust 1.46 fixed this entirely.

I've been using a VSCode devcontainer for this. The VSCode dev container definition simply grabs the "latest" version of Rust. I happened to have an older container where autocomplete worked, and a newer one where it didn't. By taking my new project, pinning the rust version to 1.46. and rebuilding my container, I had full autocomplete again.

Rust 1.47 was release very recently. The Rust extension is 5 months old.

Newbie Rustacean here... can you please give the instructions to get auto completion working in full details?

Thanks in advance.

Twaha-Rahman avatar Nov 02 '20 17:11 Twaha-Rahman

@Twaha-Rahman if you're using Code and don't insist on using RLS, try https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer.

lnicola avatar Nov 02 '20 18:11 lnicola

I find the same problem, rustc 1.47 with vscode rust plugin 0.7.8.

dainslef avatar Nov 16 '20 15:11 dainslef

I've seen this today, and I fixed it by rolling back to rust 1.46. With 1.47 the autocomplete is broken. Rolling back to rust 1.46 fixed this entirely. I've been using a VSCode devcontainer for this. The VSCode dev container definition simply grabs the "latest" version of Rust. I happened to have an older container where autocomplete worked, and a newer one where it didn't. By taking my new project, pinning the rust version to 1.46. and rebuilding my container, I had full autocomplete again. Rust 1.47 was release very recently. The Rust extension is 5 months old.

Newbie Rustacean here... can you please give the instructions to get auto completion working in full details?

Thanks in advance.

@Twaha-Rahman I'm new to Rust, so maybe there's a better solution, but this worked for me:

First, roll back to 1.46.0 and make it the default version:

rustup install 1.46.0
rustup default 1.46.0

Then, restart vscode to apply the change.

aedeny avatar Nov 16 '20 19:11 aedeny

Thanks @aedeny !

Twaha-Rahman avatar Nov 17 '20 07:11 Twaha-Rahman

I'm not sure this should be closed. The real fix is to ensure that the VS Code extension works with the latest version of Rust (i.e. the version that most developers will end up pulling, and the version that the VS Code dev containers will pull).

The roll back to 1.46 is a work around for those blocked, but is not a fix.

I suggest leaving this bug open.

martinpeck avatar Nov 17 '20 16:11 martinpeck

alright, i'll leave it open, have we got a suggested solution though? to actually fix this bug?

Milo123459 avatar Nov 18 '20 20:11 Milo123459

This can probably be closed now, the auto-completion seems to work again with Rust 1.48.0 :-)

EmrysMyrddin avatar Dec 09 '20 15:12 EmrysMyrddin

This can probably be closed now, the auto-completion seems to work again with Rust 1.48.0 :-)

I'll give it a shot and tell you guys how it goes.

Twaha-Rahman avatar Dec 09 '20 15:12 Twaha-Rahman

This can probably be closed now, the auto-completion seems to work again with Rust 1.48.0 :-)

Unfortunately, the auto-completion still doesn't work. I just ran rustup update and rustup default 1.48.0 and opened VSCode to find everything broken :( No auto-completion.

Twaha-Rahman avatar Dec 10 '20 08:12 Twaha-Rahman

Still broken for me :(

Milo123459 avatar Dec 10 '20 08:12 Milo123459

I'm still getting this issue (rustc version 1.55.0-nightly). For what it's worth, I think neither "just default to using an earlier version of Rust" nor "just use this other Rust extension instead" should be considered real solutions. This is the official Rust extension; it basic extension functionality should work out of the box. I've used matklad's extension, and it's great, but if people are in agreement that matklad's is better, then why keep this one presented in the marketplace as the recommended Rust extension?

ClydeHobart avatar Jul 04 '21 23:07 ClydeHobart

I've used matklad's extension, and it's great, but if people are in agreement that matklad's is better, then why keep this one presented in the marketplace as the recommended Rust extension?

Because while in theory rust-analyzer will replace RLS, there hasn't been much organizational work to make that happen. The two are maintained independently, and some ownership changes will probably need to happen before anything changes.

In the meanwhile, rust-analyzer works (with the exception of proc macros on nightly, but that's a different story) and is clearly useful for a lot of people, while others don't like it because it's missing on-the-fly rustc diagnostics or other language feature gaps.

So it's fine if you don't want to use an "unofficial" extension, and it's fine to expect RLS/vscode-rust bugs to be fixed, but at some point it might be worth being more pragmatic and picking the one where autocompletion works -- at least you have the choice.

And of course, if you look at the VS Code Marketplace reviews, you'll see that the current situation is not ideal for the users.

lnicola avatar Jul 07 '21 06:07 lnicola