NOTE: I am using "codium" rather than "vscode" so I think it is using an older version of Rust Analyzer.
I have a macro defined that invokes another macro. The sub-macro is not expanded by Rust Analyzer. Here is the relevant portions of the macros:
#[macro_export]
macro_rules! __method_types {
($ident:ident) => {
$crate::paste! {
pub type [< $ident Request>] = $crate::request::MethodRequest<$ident>;
pub type [< $ident Response>] = $crate::response::Response<<$ident as $crate::method::Method>::ResponseResult>;
}
};
}
#[macro_export]
macro_rules! define_method {
($ident:ident, $method_name:expr) => {
$crate::define_method!($ident, $method_name, () => ())
};
($ident:ident, $method_name:expr, $params:ty) => {
$crate::define_method!($ident, $method_name, $params => ())
};
($ident:ident, $method_name:expr, $params:ty => bool) => {
compile_error!("Using `bool` as the result type of a method is most probably not what you want. Please use `krpc_types::Success` instead or define a custom result type.");
};
($ident:ident, $method_name:expr, $params:ty => $result:ty) => {
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub struct $ident;
$crate::__method_types!($ident);
...
}
When Rust Analyzer (the latest) expands this I get:
// Recursive expansion of define_method! macro
// ============================================
#[derive(Clone,Copy,Debug,Eq,PartialEq,Hash)]
pub struct XrefUserFunctions;
impl $crate::method::Method for XrefUserFunctions {
type RequestParams = XrefUserFunctionsParams;
type ResponseResult = XrefUserFunctionsResult;
const METHOD_NAME: & 'static str = "xrefUserFunctions";
}
impl std::str::FromStr for XrefUserFunctions {
...