mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-31 17:12:53 +00:00
Fix file_structure() to recognize macro_rules!
where first token != "macro_rules"
This commit is contained in:
parent
d0b52e5d84
commit
db151763d4
@ -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…
Reference in New Issue
Block a user