rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.08k stars 1.57k forks source link

Excluding a crate from analysis? #8275

Open mexus opened 3 years ago

mexus commented 3 years ago

Is there a way to exclude a single crate from analysis?

I've got a dependency in my project that takes too much time to analyze (about 5-10 minutes on ryzen 7 2700) due to a really large amount of proc-macro generated code in it, and since there's no persistent cache in rust-analyzer, every time I reopen the project I have to wait for quite some time for the whole thing to be processed. On the other hand, it's not like I can definitely live without types/completion from that crate..

Thanks!

Kogia-sima commented 3 years ago

+1 for this. It would be better if this feature alleviates heavy memory usage by rust-analyzer.

flodiebold commented 3 years ago

Would #7449 suffice for your purposes?

mexus commented 3 years ago

Would #7449 suffice for your purposes?

In my case I've got an access to the crate that's causing troubles, so it's not impossible to add a #![rust_analyzer::skip] to its lib.rs.. but in general case I don't think the attribute could replace an "exclude a crate" capability.

DJMcNab commented 3 years ago

I guess we would probably put this in the package.metadata.rust-analyzer section of Cargo.toml, added in https://github.com/rust-analyzer/rust-analyzer/pull/7891

Basically, we'd probably make it look something like the patch section, although it would probably require a lot of plumbing to make work nicely.

mexus commented 3 years ago

I guess we would probably put this in the package.metadata.rust-analyzer section of Cargo.toml, added in #7891

Basically, we'd probably make it look something like the patch section, although it would probably require a lot of plumbing to make work nicely.

Sounds great!

pwnorbitals commented 2 years ago

https://app.bountysource.com/issues/97550097-excluding-a-crate-from-analysis

azizur commented 5 days ago

https://app.bountysource.com/issues/97550097-excluding-a-crate-from-analysis

The site is temporarily down