Closed CrackTheCode016 closed 7 months ago
This is definitely not the guide I was expecting to see regarding rust analyzer.
First, I think it is important to just describe at a high level why rust analyzer struggles with substrate.
Then you should make suggestions on ways that rust-analyzer will perform better in general. For example, opening just your pallet or runtime folder, rather than having rust analyzer work on top of the entire substrate binary. If you limit the scope of where you are working, then rust analyzer will be faster.
Then you should map suggestions in your guide to why it is a suggestion. For example, removing cargo-check
is a big downgrade for people, so they should have context as to why this is being disabled: so that your compiler is not rebuilding/checking the whole project each time you press save. This is useful if your compiler is not very strong to begin with, or you are limited on power consumption.
OR an alternative here is to actually change the build directory for Rust Analyzer: https://www.reddit.com/r/rust/comments/jrpn83/help_with_rustanalyzer_locking_the_build/
This is good when you have unlimited compute / power, but you just don't want to be locked out from compiling things yourself while rust analyzer is working in the background. This is a better option for people using the powerful M2 or AMD processors. The downside is that you are literally building everything twice, but often if your computer is powerful enough, this doesn't matter.
There are also many other tricks which can be found throughout our forums for tricks to make rust analyzer better which I would expect to see here. @kianenigma, @andresilva, @nukemandan might have some of their own:
I would also include instructions for how to quickly disable rust analyzer, and then enable it as a final fallback when it is just taking too much out of the system, or perhaps how to hot swap "almost everything disabled" config from "a well running setup".
Speaking of which, I expected to see JSON configs which could be simply copy and pasted (or script installed) into the users computer rather than having them navigate and click buttons through UX.
I would also expect to see multiple JSON config options from "high power computer", "average computer", "low power computer, and the user could copy the config which is right for them.
You really should link this PR in the main Substrate / Polkadot developer channels and have them contribute their config files and tricks.
A few base settings to make Substrate dev less destructive to ones computer in VSCode