Mono repo scalable with Rust-analyzer in VSCode?

I've always flip-flopped on mono repos, but I'm now convinced a mono-repo in Rust is particularly disastrous since Rust-analyzer essentially goes out to lunch with ~30 or so crates all using fairly large-on-disk dependencies like Polars and AWS SDK (my build folder is around 1GB per crate).

It is what it is? Or are there tailored-made solutions in VSCode without losing useful linting?

I'm all but convinced it's time to break apart my mono repo and just checking one last time in case the community has strong feelings in support of mono repos like this before I throw the baby out with the bathwater.

I could share additional details, but really they are fairly standard crates referencing each other using relative paths in the Cargo.toml. The only tricky part is if I break up my mono-repo, for simplicity I'll likely tie everything back together using git revision hash references for their dependencies in my Cargo.toml. Will be annoying committing updates but amazing not having to wait 10+ minutes for Rust-analyzer cold starts.

Rust-analyzer shouldn't perform significantly worse if you have all your dependencies in the workspace vs. if you have them as git dependencies. Either way, it will have to analyze all the code. What might take a lot more time is running cargo check on all the projects in the workspace. For a large workspace, you might want to try disabling that (rust-analyzer.checkOnSave). You can also try disabling rust-analyzer.cachePriming.enable, which will save on startup time but make actual requests slower in the beginning.

Thanks, this confirms my decision is probably justified breaking it up. I really don't want to disable features when it's just as easy to break apart the mono repo.

I actually wonder how anyone works with mono-repos these days (Rust or otherwise), especially as linting has become so common place now. I guess if it's just a repo of bash scripts it wouldn't be so bad, but even for quite a while now Python has had significant type checking implemented.

What are you doing in This can be a pain point with rust-analyzer. If you have a nontrivial build script you might want to separate the code that depends on it into a separate crate within the same workspace.

no at all - just a Cargo.toml. I switched from the mono repo and everything is running much much faster! Thanks to git revision dependencies, there's really no downsides since that keeps the dependency management simple still.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.