mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 17:28:09 +00:00
show macros in file structure
This commit is contained in:
parent
5d829841cd
commit
46c453d0d3
2 changed files with 25 additions and 5 deletions
|
@ -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()",
|
||||
|
|
|
@ -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() {}
|
||||
|
||||
|
|
Loading…
Reference in a new issue