mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Render matched macro arm on hover of macro calls
This commit is contained in:
parent
062e1b9b81
commit
6bfdd38c69
11 changed files with 133 additions and 65 deletions
|
@ -1246,6 +1246,17 @@ impl<'db> SemanticsImpl<'db> {
|
|||
.map_or(false, |m| matches!(m.id, MacroId::ProcMacroId(..)))
|
||||
}
|
||||
|
||||
pub fn resolve_macro_call_arm(&self, macro_call: &ast::MacroCall) -> Option<u32> {
|
||||
let sa = self.analyze(macro_call.syntax())?;
|
||||
self.db
|
||||
.parse_macro_expansion(
|
||||
sa.expand(self.db, self.wrap_node_infile(macro_call.clone()).as_ref())?,
|
||||
)
|
||||
.value
|
||||
.1
|
||||
.matched_arm
|
||||
}
|
||||
|
||||
pub fn is_unsafe_macro_call(&self, macro_call: &ast::MacroCall) -> bool {
|
||||
let sa = match self.analyze(macro_call.syntax()) {
|
||||
Some(it) => it,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue