aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaterina Babshukova <[email protected]>2019-06-28 22:08:02 +0100
committerEkaterina Babshukova <[email protected]>2019-06-28 22:08:02 +0100
commit46c453d0d3249bf83330c2f68fe352bd1dd36b5e (patch)
tree26820b98a67547d3e4091b428645d1b8bc2e718a
parent5d829841cdab630d7953defd12e024e46ecc7c4f (diff)
show macros in file structure
-rw-r--r--crates/ra_ide_api/src/display/snapshots/tests__file_structure.snap19
-rw-r--r--crates/ra_ide_api/src/display/structure.rs11
2 files changed, 25 insertions, 5 deletions
diff --git a/crates/ra_ide_api/src/display/snapshots/tests__file_structure.snap b/crates/ra_ide_api/src/display/snapshots/tests__file_structure.snap
index 3097977de..102efc026 100644
--- a/crates/ra_ide_api/src/display/snapshots/tests__file_structure.snap
+++ b/crates/ra_ide_api/src/display/snapshots/tests__file_structure.snap
@@ -1,5 +1,5 @@
1--- 1---
2created: "2019-05-23T22:23:35.168422050Z" 2created: "2019-06-28T20:46:18.274464142Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/display/structure.rs 4source: crates/ra_ide_api/src/display/structure.rs
5expression: structure 5expression: structure
@@ -159,9 +159,18 @@ expression: structure
159 }, 159 },
160 StructureNode { 160 StructureNode {
161 parent: None, 161 parent: None,
162 label: "mc",
163 navigation_range: [284; 286),
164 node_range: [271; 303),
165 kind: MACRO_CALL,
166 detail: None,
167 deprecated: false,
168 },
169 StructureNode {
170 parent: None,
162 label: "obsolete", 171 label: "obsolete",
163 navigation_range: [288; 296), 172 navigation_range: [322; 330),
164 node_range: [271; 301), 173 node_range: [305; 335),
165 kind: FN_DEF, 174 kind: FN_DEF,
166 detail: Some( 175 detail: Some(
167 "fn()", 176 "fn()",
@@ -171,8 +180,8 @@ expression: structure
171 StructureNode { 180 StructureNode {
172 parent: None, 181 parent: None,
173 label: "very_obsolete", 182 label: "very_obsolete",
174 navigation_range: [341; 354), 183 navigation_range: [375; 388),
175 node_range: [303; 359), 184 node_range: [337; 393),
176 kind: FN_DEF, 185 kind: FN_DEF,
177 detail: Some( 186 detail: Some(
178 "fn()", 187 "fn()",
diff --git a/crates/ra_ide_api/src/display/structure.rs b/crates/ra_ide_api/src/display/structure.rs
index 24ab7b59c..e5057e833 100644
--- a/crates/ra_ide_api/src/display/structure.rs
+++ b/crates/ra_ide_api/src/display/structure.rs
@@ -142,6 +142,13 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
142 }; 142 };
143 Some(node) 143 Some(node)
144 }) 144 })
145 .visit(|mc: &ast::MacroCall| {
146 let first_token = mc.syntax().first_token().unwrap();
147 if first_token.text().as_str() != "macro_rules" {
148 return None;
149 }
150 decl(mc)
151 })
145 .accept(node)? 152 .accept(node)?
146} 153}
147 154
@@ -177,6 +184,10 @@ impl E {}
177 184
178impl fmt::Debug for E {} 185impl fmt::Debug for E {}
179 186
187macro_rules! mc {
188 () => {}
189}
190
180#[deprecated] 191#[deprecated]
181fn obsolete() {} 192fn obsolete() {}
182 193