mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Fix file_structure() to recognize macro_rules!
where first token != "macro_rules"
This commit is contained in:
parent
d0b52e5d84
commit
db151763d4
1 changed files with 17 additions and 3 deletions
|
@ -151,10 +151,24 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
|
|||
Some(node)
|
||||
},
|
||||
ast::MacroCall(it) => {
|
||||
let first_token = it.syntax().first_token().unwrap();
|
||||
if first_token.text().as_str() != "macro_rules" {
|
||||
return None;
|
||||
let macro_name = it.syntax()
|
||||
.children()
|
||||
.find(|c|
|
||||
![
|
||||
SyntaxKind::COMMENT,
|
||||
SyntaxKind::WHITESPACE,
|
||||
SyntaxKind::ATTR
|
||||
].iter()
|
||||
.any(|&k| k == c.kind())
|
||||
);
|
||||
|
||||
match macro_name {
|
||||
None => return None,
|
||||
Some(n) => if n.first_token().unwrap().text().as_str() != "macro_rules" {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
decl(it)
|
||||
},
|
||||
_ => None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue