diff options
author | Aleksey Kladov <[email protected]> | 2019-01-26 07:12:00 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-26 07:12:00 +0000 |
commit | ba4c5021c4e6fb8e190de945cad7c453e770e529 (patch) | |
tree | 574ac4b41f8497941c854e14ebc1382f0b668578 /crates/ra_ide_api_light | |
parent | 154ab4206d2fd9493a3665fb72f9bd710a577944 (diff) |
list enum variants in the outline
Diffstat (limited to 'crates/ra_ide_api_light')
-rw-r--r-- | crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap | 26 | ||||
-rw-r--r-- | crates/ra_ide_api_light/src/structure.rs | 1 |
2 files changed, 24 insertions, 3 deletions
diff --git a/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap b/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap index b96398950..270f75a56 100644 --- a/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap +++ b/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap | |||
@@ -1,8 +1,8 @@ | |||
1 | --- | 1 | --- |
2 | created: "2019-01-24T18:04:00.090162+00:00" | 2 | created: "2019-01-26T07:11:02.463391362+00:00" |
3 | creator: insta@0.4.0 | 3 | creator: insta@0.5.2 |
4 | expression: structure | 4 | expression: structure |
5 | source: "crates\\ra_ide_api_light\\src\\structure.rs" | 5 | source: crates/ra_ide_api_light/src/structure.rs |
6 | --- | 6 | --- |
7 | [ | 7 | [ |
8 | StructureNode { | 8 | StructureNode { |
@@ -78,6 +78,26 @@ source: "crates\\ra_ide_api_light\\src\\structure.rs" | |||
78 | detail: None | 78 | detail: None |
79 | }, | 79 | }, |
80 | StructureNode { | 80 | StructureNode { |
81 | parent: Some( | ||
82 | 6 | ||
83 | ), | ||
84 | label: "X", | ||
85 | navigation_range: [169; 170), | ||
86 | node_range: [169; 170), | ||
87 | kind: ENUM_VARIANT, | ||
88 | detail: None | ||
89 | }, | ||
90 | StructureNode { | ||
91 | parent: Some( | ||
92 | 6 | ||
93 | ), | ||
94 | label: "Y", | ||
95 | navigation_range: [172; 173), | ||
96 | node_range: [172; 178), | ||
97 | kind: ENUM_VARIANT, | ||
98 | detail: None | ||
99 | }, | ||
100 | StructureNode { | ||
81 | parent: None, | 101 | parent: None, |
82 | label: "T", | 102 | label: "T", |
83 | navigation_range: [186; 187), | 103 | navigation_range: [186; 187), |
diff --git a/crates/ra_ide_api_light/src/structure.rs b/crates/ra_ide_api_light/src/structure.rs index e3713c217..4e080ed03 100644 --- a/crates/ra_ide_api_light/src/structure.rs +++ b/crates/ra_ide_api_light/src/structure.rs | |||
@@ -103,6 +103,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
103 | .visit(decl::<ast::StructDef>) | 103 | .visit(decl::<ast::StructDef>) |
104 | .visit(|nfd: &ast::NamedFieldDef| decl_with_type_ref(nfd, nfd.type_ref())) | 104 | .visit(|nfd: &ast::NamedFieldDef| decl_with_type_ref(nfd, nfd.type_ref())) |
105 | .visit(decl::<ast::EnumDef>) | 105 | .visit(decl::<ast::EnumDef>) |
106 | .visit(decl::<ast::EnumVariant>) | ||
106 | .visit(decl::<ast::TraitDef>) | 107 | .visit(decl::<ast::TraitDef>) |
107 | .visit(decl::<ast::Module>) | 108 | .visit(decl::<ast::Module>) |
108 | .visit(|td: &ast::TypeDef| decl_with_type_ref(td, td.type_ref())) | 109 | .visit(|td: &ast::TypeDef| decl_with_type_ref(td, td.type_ref())) |