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

Allow flycheck to be configured to only check transitive dependents of the current crate

Open Veykril opened this issue 1 year ago • 3 comments

Forgot whether we already have an issue for this but currently we allow flycheck to check the whole workspace or only the crate itself, we shoukd have a third mode that checks the crate and its transitive dependents which ought to be faster than checking the whole workspace. The interesting question is whether this would make sense for cargo itself to have?

cc https://github.com/rust-lang/rust-analyzer/discussions/17379

Veykril avatar Jun 12 '24 08:06 Veykril

The interesting question is whether this would make sense for cargo itself to have?

This might be me spending too much time with Buck, but I wanted some lightweight queries in Cargo for ages. This specific mode could be a hypothetical cargo build 'rdeps(:saved_cargo_target)', but for performance reasons, I suspect that would require Cargo to have a persistent daemon.

Selfishly, that query interface could be used to power https://github.com/rust-lang/rust-analyzer/pull/17246, but as a replacement for cargo-metadata implicit pathing.

davidbarsky avatar Jun 12 '24 20:06 davidbarsky

Why would that require a daemon? Instead of building the full graph it would merely do a slice of it. That's all I see relevant here (though obviously i have no knowledge about cargo's inner workings)

Veykril avatar Jun 13 '24 09:06 Veykril

I mean, strictly speaking, it doesn't really need to be a daemon, but it really does help with amortizing some file system operations, especially if you want to quickly answer "what Cargo.toml owns this Rust files?". For things like rdeps, you don't really need a daemon—something like sqlite is probably enough—but depending on the query, it's not a bad idea.

Anyways, I got this issue off-track, sorry about that.

davidbarsky avatar Jun 13 '24 12:06 davidbarsky