I filed a issue on `rust-analyzer` and apparently it is by design - https://github.com/rust-lang/rust-analyzer/issues/14375
I mean it’s fairly obvious. You can do this through build.rs files as well.
There was talk about trying to compile proc macros to WASM and run them sandboxed in the compiler. Not sure what happened to that RFC (by dtolnay?)
There is a POC. https://github.com/dtolnay/watt