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

RLS/Clippy doesn't lint newly created files

Open stinodego opened this issue 4 years ago • 6 comments

Whenever I create a new .rs file in my project, I don't receive any warnings/lints until I restart VSCode. After I restart, everything works as expected.

I'm sure I must be doing something wrong; could someone help me out?

I am using VSCode through Windows Subsystem for Linux.

UPDATE: Including the file as a module in lib.rs fixes the issue. However, creating a main.rs is still problematic, as this file is not included in lib.rs.

stinodego avatar Aug 01 '21 05:08 stinodego

Can you try https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer instead (though it might be a bit finicky to set up in WSL -- you need to install it on the remote side and make sure everything is in PATH).

lnicola avatar Aug 01 '21 06:08 lnicola

Sure, I'll give that a shot! Will report back.

stinodego avatar Aug 01 '21 06:08 stinodego

Can you try https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer instead (though it might be a bit finicky to set up in WSL -- you need to install it on the remote side and make sure everything is in PATH).

Yes, if I disable the Rust extension and enable rust-analyzer instead, everything works as expected. Installing was easy by the way, no need to mess around with PATH or anything.

How does this extension compare to the "Rust" extension otherwise?

stinodego avatar Aug 01 '21 06:08 stinodego

See https://rust-analyzer.github.io/blog/2020/04/20/first-release.html and https://rust-lang.github.io/compiler-team/working-groups/rls-2.0/. It's supposed to replace RLS at some point, but it's currently developed outside of the Rust project.

How does this extension compare to the "Rust" extension otherwise?

Favourably, in my (biased, as a rust-analyzer contributor) opinion :-).

lnicola avatar Aug 01 '21 06:08 lnicola

I'll still keep this issue open for now, as it seems relevant to the Rust extension.

My first impression of rust-analyzer is that it tries to do too much; I prefer simplicity. But that's just my very first impression, I might give it a shot later.

stinodego avatar Aug 01 '21 06:08 stinodego

You can disable most features, if that's what you mean, check out the manual or file an issue on that repo.

In a sense, it does less since it delegates formatting (to rustfmt) and most diagnostics (to cargo check).

lnicola avatar Aug 01 '21 06:08 lnicola