Skip to content

Commit c590cfb

Browse files
committed
fix: ensure that highlight_related works for macro_expr
1 parent 92d0ee8 commit c590cfb

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/tools/rust-analyzer/crates/ide/src/goto_definition.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use ide_db::{
1414
FileId, RootDatabase,
1515
};
1616
use itertools::Itertools;
17-
use span::FileRange;
1817
use syntax::{
1918
ast::{self, HasLoopBody, Label},
2019
match_ast, AstNode, AstToken,

src/tools/rust-analyzer/crates/ide/src/highlight_related.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,12 +575,20 @@ impl<'a> WalkExpandedExprCtx<'a> {
575575
}
576576

577577
if let ast::Expr::MacroExpr(expr) = expr {
578-
if let Some(expanded) = expr
579-
.macro_call()
580-
.and_then(|call| self.sema.expand(&call))
581-
.and_then(ast::MacroStmts::cast)
578+
if let Some(expanded) =
579+
expr.macro_call().and_then(|call| self.sema.expand(&call))
582580
{
583-
self.handle_expanded(expanded, cb);
581+
match_ast! {
582+
match expanded {
583+
ast::MacroStmts(it) => {
584+
self.handle_expanded(it, cb);
585+
},
586+
ast::Expr(it) => {
587+
self.walk(&it, cb);
588+
},
589+
_ => {}
590+
}
591+
}
584592
}
585593
}
586594
}

0 commit comments

Comments
 (0)