aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api_light
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-02-25 10:51:37 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-02-25 10:51:37 +0000
commitcec637a3a91f0a34989dfde15ea853bbe8dc8a53 (patch)
treed813eb7be81dadbeced5ea0cf056d974cfd0fea5 /crates/ra_ide_api_light
parent7ffff9c74caae108db53366e3b90857b7c405c6c (diff)
parent78f10fcdc41d5c58e386bc99a94b34a2bdbaa4cd (diff)
Merge #898
898: rename type to type_alias in the AST as well r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api_light')
-rw-r--r--crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap2
-rw-r--r--crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap.new182
-rw-r--r--crates/ra_ide_api_light/src/structure.rs2
3 files changed, 184 insertions, 2 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 413f4a5ff..8e4184b31 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
@@ -111,7 +111,7 @@ expression: structure
111 label: "T", 111 label: "T",
112 navigation_range: [186; 187), 112 navigation_range: [186; 187),
113 node_range: [181; 193), 113 node_range: [181; 193),
114 kind: TYPE_DEF, 114 kind: TYPE_ALIAS_DEF,
115 detail: Some( 115 detail: Some(
116 "()" 116 "()"
117 ), 117 ),
diff --git a/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap.new b/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap.new
new file mode 100644
index 000000000..a3c6cd9ce
--- /dev/null
+++ b/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap.new
@@ -0,0 +1,182 @@
1---
2created: "2019-02-25T10:38:16.909647631Z"
3creator: [email protected]
4source: crates/ra_ide_api_light/src/structure.rs
5expression: structure
6---
7[
8 StructureNode {
9 parent: None,
10 label: "Foo",
11 navigation_range: [8; 11),
12 node_range: [1; 26),
13 kind: STRUCT_DEF,
14 detail: None,
15 deprecated: false
16 },
17 StructureNode {
18 parent: Some(
19 0
20 ),
21 label: "x",
22 navigation_range: [18; 19),
23 node_range: [18; 24),
24 kind: NAMED_FIELD_DEF,
25 detail: Some(
26 "i32"
27 ),
28 deprecated: false
29 },
30 StructureNode {
31 parent: None,
32 label: "m",
33 navigation_range: [32; 33),
34 node_range: [28; 158),
35 kind: MODULE,
36 detail: None,
37 deprecated: false
38 },
39 StructureNode {
40 parent: Some(
41 2
42 ),
43 label: "bar1",
44 navigation_range: [43; 47),
45 node_range: [40; 52),
46 kind: FN_DEF,
47 detail: Some(
48 "fn()"
49 ),
50 deprecated: false
51 },
52 StructureNode {
53 parent: Some(
54 2
55 ),
56 label: "bar2",
57 navigation_range: [60; 64),
58 node_range: [57; 81),
59 kind: FN_DEF,
60 detail: Some(
61 "fn<T>(t: T) -> T"
62 ),
63 deprecated: false
64 },
65 StructureNode {
66 parent: Some(
67 2
68 ),
69 label: "bar3",
70 navigation_range: [89; 93),
71 node_range: [86; 156),
72 kind: FN_DEF,
73 detail: Some(
74 "fn<A, B>(a: A, b: B) -> Vec< u32 >"
75 ),
76 deprecated: false
77 },
78 StructureNode {
79 parent: None,
80 label: "E",
81 navigation_range: [165; 166),
82 node_range: [160; 180),
83 kind: ENUM_DEF,
84 detail: None,
85 deprecated: false
86 },
87 StructureNode {
88 parent: Some(
89 6
90 ),
91 label: "X",
92 navigation_range: [169; 170),
93 node_range: [169; 170),
94 kind: ENUM_VARIANT,
95 detail: None,
96 deprecated: false
97 },
98 StructureNode {
99 parent: Some(
100 6
101 ),
102 label: "Y",
103 navigation_range: [172; 173),
104 node_range: [172; 178),
105 kind: ENUM_VARIANT,
106 detail: None,
107 deprecated: false
108 },
109 StructureNode {
110 parent: None,
111 label: "T",
112 navigation_range: [186; 187),
113 node_range: [181; 193),
114 kind: TYPE_ALIAS_DEF,
115 detail: Some(
116 "()"
117 ),
118 deprecated: false
119 },
120 StructureNode {
121 parent: None,
122 label: "S",
123 navigation_range: [201; 202),
124 node_range: [194; 213),
125 kind: STATIC_DEF,
126 detail: Some(
127 "i32"
128 ),
129 deprecated: false
130 },
131 StructureNode {
132 parent: None,
133 label: "C",
134 navigation_range: [220; 221),
135 node_range: [214; 232),
136 kind: CONST_DEF,
137 detail: Some(
138 "i32"
139 ),
140 deprecated: false
141 },
142 StructureNode {
143 parent: None,
144 label: "impl E",
145 navigation_range: [239; 240),
146 node_range: [234; 243),
147 kind: IMPL_BLOCK,
148 detail: None,
149 deprecated: false
150 },
151 StructureNode {
152 parent: None,
153 label: "impl fmt::Debug for E",
154 navigation_range: [265; 266),
155 node_range: [245; 269),
156 kind: IMPL_BLOCK,
157 detail: None,
158 deprecated: false
159 },
160 StructureNode {
161 parent: None,
162 label: "obsolete",
163 navigation_range: [288; 296),
164 node_range: [271; 301),
165 kind: FN_DEF,
166 detail: Some(
167 "fn()"
168 ),
169 deprecated: true
170 },
171 StructureNode {
172 parent: None,
173 label: "very_obsolete",
174 navigation_range: [341; 354),
175 node_range: [303; 359),
176 kind: FN_DEF,
177 detail: Some(
178 "fn()"
179 ),
180 deprecated: true
181 }
182]
diff --git a/crates/ra_ide_api_light/src/structure.rs b/crates/ra_ide_api_light/src/structure.rs
index 75afd1181..dea494daa 100644
--- a/crates/ra_ide_api_light/src/structure.rs
+++ b/crates/ra_ide_api_light/src/structure.rs
@@ -112,7 +112,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
112 .visit(decl::<ast::EnumVariant>) 112 .visit(decl::<ast::EnumVariant>)
113 .visit(decl::<ast::TraitDef>) 113 .visit(decl::<ast::TraitDef>)
114 .visit(decl::<ast::Module>) 114 .visit(decl::<ast::Module>)
115 .visit(|td: &ast::TypeDef| decl_with_type_ref(td, td.type_ref())) 115 .visit(|td: &ast::TypeAliasDef| decl_with_type_ref(td, td.type_ref()))
116 .visit(|cd: &ast::ConstDef| decl_with_type_ref(cd, cd.type_ref())) 116 .visit(|cd: &ast::ConstDef| decl_with_type_ref(cd, cd.type_ref()))
117 .visit(|sd: &ast::StaticDef| decl_with_type_ref(sd, sd.type_ref())) 117 .visit(|sd: &ast::StaticDef| decl_with_type_ref(sd, sd.type_ref()))
118 .visit(|im: &ast::ImplBlock| { 118 .visit(|im: &ast::ImplBlock| {