intellij-rust / intellij-rust

Rust plugin for the IntelliJ Platform
https://intellij-rust.github.io
MIT License
4.53k stars 380 forks source link

feature: analyze code in macro #8831

Open doki23 opened 2 years ago

doki23 commented 2 years ago

Support analyzing code in macro such as going to implementations from the macro and recognizing variables defined in the macro.

For example,

let_extract!(
      Expression::WindowFunction {
          op, // define it here
          params,
          args,
          partition_by,
          order_by,
          window_frame
      },
      self.window_func,
      panic!()
);
some_func(op); // use it here, but rust plugin cannot recognize it.
vlad20012 commented 2 years ago

Macros work in general, but it's possible there are some bugs. So please, share more info about your specific macro that doesn't work,

doki23 commented 2 years ago
截屏2022-05-13 10 13 38

I use crate extract_enum to extract fields in my enum struct. The macro let_extract! defines some variables like the pic: op,params,args,partition_by,order_by,window_frame, but ide complains it's an unresolved reference: `args`