almel
almel

Reputation: 7968

RLS: how to automatically resolve import errors in Visual Studio Code?

I recently switched from IntelliJ to Visual Studio Code, but one thing I can't figure out is how to tell my editor to automatically write a

use std::sync::Arc;

at the top of my file when I have something like the following import error:

Rust import error in VSC

In IntelliJ all I had to do was click on the red error icon and select "Import" and the use would appear at the top of the file.

I have the RLS extension for VSC. How do I do this?

Upvotes: 5

Views: 4293

Answers (1)

CowZow
CowZow

Reputation: 1424

Instead of the RLS extension, I switched to using the rust-analyzer vscode extension which supports suggesting imports as one of the "Quick Fix" options in vscode.

Upvotes: 4

Related Questions