diff options
author | Roland Ruckerbauer <[email protected]> | 2020-01-10 19:35:23 +0000 |
---|---|---|
committer | Roland Ruckerbauer <[email protected]> | 2020-01-12 16:34:57 +0000 |
commit | db151763d42c725685bb9e86a16fa2b6cb7a64c7 (patch) | |
tree | c4119c56f4345f1306a370c99a63afc1aae2eb4a /crates/ra_ide | |
parent | d0b52e5d84b8c371b74d4d5d43f45be91f103d12 (diff) |
Fix file_structure() to recognize macro_rules!
where first token != "macro_rules"
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/display/structure.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/crates/ra_ide/src/display/structure.rs b/crates/ra_ide/src/display/structure.rs index a80d65ac7..be21fa913 100644 --- a/crates/ra_ide/src/display/structure.rs +++ b/crates/ra_ide/src/display/structure.rs | |||
@@ -151,10 +151,24 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
151 | Some(node) | 151 | Some(node) |
152 | }, | 152 | }, |
153 | ast::MacroCall(it) => { | 153 | ast::MacroCall(it) => { |
154 | let first_token = it.syntax().first_token().unwrap(); | 154 | let macro_name = it.syntax() |
155 | if first_token.text().as_str() != "macro_rules" { | 155 | .children() |
156 | return None; | 156 | .find(|c| |
157 | ![ | ||
158 | SyntaxKind::COMMENT, | ||
159 | SyntaxKind::WHITESPACE, | ||
160 | SyntaxKind::ATTR | ||
161 | ].iter() | ||
162 | .any(|&k| k == c.kind()) | ||
163 | ); | ||
164 | |||
165 | match macro_name { | ||
166 | None => return None, | ||
167 | Some(n) => if n.first_token().unwrap().text().as_str() != "macro_rules" { | ||
168 | return None; | ||
169 | } | ||
157 | } | 170 | } |
171 | |||
158 | decl(it) | 172 | decl(it) |
159 | }, | 173 | }, |
160 | _ => None, | 174 | _ => None, |