mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
fix: ensure that highlight_related works for macro_expr
This commit is contained in:
parent
ae6e8d56d4
commit
d94dcfa841
2 changed files with 13 additions and 6 deletions
|
@ -14,7 +14,6 @@ use ide_db::{
|
||||||
FileId, RootDatabase,
|
FileId, RootDatabase,
|
||||||
};
|
};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use span::FileRange;
|
|
||||||
use syntax::{
|
use syntax::{
|
||||||
ast::{self, HasLoopBody, Label},
|
ast::{self, HasLoopBody, Label},
|
||||||
match_ast, AstNode, AstToken,
|
match_ast, AstNode, AstToken,
|
||||||
|
|
|
@ -575,12 +575,20 @@ impl<'a> WalkExpandedExprCtx<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let ast::Expr::MacroExpr(expr) = expr {
|
if let ast::Expr::MacroExpr(expr) = expr {
|
||||||
if let Some(expanded) = expr
|
if let Some(expanded) =
|
||||||
.macro_call()
|
expr.macro_call().and_then(|call| self.sema.expand(&call))
|
||||||
.and_then(|call| self.sema.expand(&call))
|
|
||||||
.and_then(ast::MacroStmts::cast)
|
|
||||||
{
|
{
|
||||||
self.handle_expanded(expanded, cb);
|
match_ast! {
|
||||||
|
match expanded {
|
||||||
|
ast::MacroStmts(it) => {
|
||||||
|
self.handle_expanded(it, cb);
|
||||||
|
},
|
||||||
|
ast::Expr(it) => {
|
||||||
|
self.walk(&it, cb);
|
||||||
|
},
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue