1452: Show macros in file structure r=matklad a=viorina



Co-authored-by: Ekaterina Babshukova <ekaterina.babshukova@yandex.ru>
This commit is contained in:
bors[bot] 2019-06-28 21:24:25 +00:00
commit 1512ab31a0
2 changed files with 25 additions and 5 deletions

View file

@ -1,5 +1,5 @@
---
created: "2019-05-23T22:23:35.168422050Z"
created: "2019-06-28T20:46:18.274464142Z"
creator: insta@0.8.1
source: crates/ra_ide_api/src/display/structure.rs
expression: structure
@ -157,11 +157,20 @@ expression: structure
detail: None,
deprecated: false,
},
StructureNode {
parent: None,
label: "mc",
navigation_range: [284; 286),
node_range: [271; 303),
kind: MACRO_CALL,
detail: None,
deprecated: false,
},
StructureNode {
parent: None,
label: "obsolete",
navigation_range: [288; 296),
node_range: [271; 301),
navigation_range: [322; 330),
node_range: [305; 335),
kind: FN_DEF,
detail: Some(
"fn()",
@ -171,8 +180,8 @@ expression: structure
StructureNode {
parent: None,
label: "very_obsolete",
navigation_range: [341; 354),
node_range: [303; 359),
navigation_range: [375; 388),
node_range: [337; 393),
kind: FN_DEF,
detail: Some(
"fn()",

View file

@ -142,6 +142,13 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
};
Some(node)
})
.visit(|mc: &ast::MacroCall| {
let first_token = mc.syntax().first_token().unwrap();
if first_token.text().as_str() != "macro_rules" {
return None;
}
decl(mc)
})
.accept(node)?
}
@ -177,6 +184,10 @@ impl E {}
impl fmt::Debug for E {}
macro_rules! mc {
() => {}
}
#[deprecated]
fn obsolete() {}