I have the following kind of layout that runs fine, but VS Code / rust-analyser choke on it. I want at least my utility functions and macros to show documentation on hover. I realise rustdoc still has a problem documenting normal stuff, so I'm willing to access everything via lib.rs
. But I tried several times (utils only, or even also business logic) managing only to access functions, not macros.
It's worse: as it is, VS code can't even jump to definition or declaration. The latest version (detailed below) added horrible squiggles, saying "unresolved module, can't find module file: utils/f.rs" etc.
// src/main.rs
#[macro_use]
pub mod utils {
#[macro_use]
pub mod f;
}
pub mod x;
fn main() {
x::x();
}
// src/utils/f.rs
/** I'm a happy macro */
macro_rules! m {
() => { println!("McRoe"); };
}
/** I'm a happy function */
pub fn f() {
println!("Fun K. Shen");
}
// src/x.rs
use crate::utils::f::*;
/** I'm business logic */
pub fn x() {
m!();
f();
}
Version: 1.78.2
Commit: b3e4e68a0bc097f0ae7907b217c1119af9e03435
Date: 2023-05-10T14:47:05.613Z
Electron: 22.5.2
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Linux x64 6.1.0-0.deb11.5-amd64
Sandboxed: No
rust-analyzer: 0.4.1521@linux-x64