mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +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)
|
Some(node)
|
||||||
},
|
},
|
||||||
ast::MacroCall(it) => {
|
ast::MacroCall(it) => {
|
||||||
let first_token = it.syntax().first_token().unwrap();
|
let macro_name = it.syntax()
|
||||||
if first_token.text().as_str() != "macro_rules" {
|
.children()
|
||||||
return None;
|
.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)
|
decl(it)
|
||||||
},
|
},
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue