diff options
Diffstat (limited to 'crates/ra_ide_api/src/goto_definition.rs')
-rw-r--r-- | crates/ra_ide_api/src/goto_definition.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index ed9d99a7f..b6c72efdf 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs | |||
@@ -25,11 +25,11 @@ pub(crate) fn goto_definition( | |||
25 | let res = match_ast! { | 25 | let res = match_ast! { |
26 | match (token.value.parent()) { | 26 | match (token.value.parent()) { |
27 | ast::NameRef(name_ref) => { | 27 | ast::NameRef(name_ref) => { |
28 | let navs = reference_definition(db, token.with_ast(&name_ref)).to_vec(); | 28 | let navs = reference_definition(db, token.with_value(&name_ref)).to_vec(); |
29 | RangeInfo::new(name_ref.syntax().text_range(), navs.to_vec()) | 29 | RangeInfo::new(name_ref.syntax().text_range(), navs.to_vec()) |
30 | }, | 30 | }, |
31 | ast::Name(name) => { | 31 | ast::Name(name) => { |
32 | let navs = name_definition(db, token.with_ast(&name))?; | 32 | let navs = name_definition(db, token.with_value(&name))?; |
33 | RangeInfo::new(name.syntax().text_range(), navs) | 33 | RangeInfo::new(name.syntax().text_range(), navs) |
34 | 34 | ||
35 | }, | 35 | }, |
@@ -99,7 +99,7 @@ pub(crate) fn name_definition( | |||
99 | 99 | ||
100 | if let Some(module) = ast::Module::cast(parent.clone()) { | 100 | if let Some(module) = ast::Module::cast(parent.clone()) { |
101 | if module.has_semi() { | 101 | if module.has_semi() { |
102 | let src = name.with_ast(module); | 102 | let src = name.with_value(module); |
103 | if let Some(child_module) = hir::Module::from_declaration(db, src) { | 103 | if let Some(child_module) = hir::Module::from_declaration(db, src) { |
104 | let nav = child_module.to_nav(db); | 104 | let nav = child_module.to_nav(db); |
105 | return Some(vec![nav]); | 105 | return Some(vec![nav]); |
@@ -107,7 +107,7 @@ pub(crate) fn name_definition( | |||
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | if let Some(nav) = named_target(db, name.with_ast(&parent)) { | 110 | if let Some(nav) = named_target(db, name.with_value(&parent)) { |
111 | return Some(vec![nav]); | 111 | return Some(vec![nav]); |
112 | } | 112 | } |
113 | 113 | ||
@@ -120,7 +120,7 @@ fn named_target(db: &RootDatabase, node: Source<&SyntaxNode>) -> Option<Navigati | |||
120 | ast::StructDef(it) => { | 120 | ast::StructDef(it) => { |
121 | Some(NavigationTarget::from_named( | 121 | Some(NavigationTarget::from_named( |
122 | db, | 122 | db, |
123 | node.with_ast(&it), | 123 | node.with_value(&it), |
124 | it.doc_comment_text(), | 124 | it.doc_comment_text(), |
125 | it.short_label(), | 125 | it.short_label(), |
126 | )) | 126 | )) |
@@ -128,7 +128,7 @@ fn named_target(db: &RootDatabase, node: Source<&SyntaxNode>) -> Option<Navigati | |||
128 | ast::EnumDef(it) => { | 128 | ast::EnumDef(it) => { |
129 | Some(NavigationTarget::from_named( | 129 | Some(NavigationTarget::from_named( |
130 | db, | 130 | db, |
131 | node.with_ast(&it), | 131 | node.with_value(&it), |
132 | it.doc_comment_text(), | 132 | it.doc_comment_text(), |
133 | it.short_label(), | 133 | it.short_label(), |
134 | )) | 134 | )) |
@@ -136,7 +136,7 @@ fn named_target(db: &RootDatabase, node: Source<&SyntaxNode>) -> Option<Navigati | |||
136 | ast::EnumVariant(it) => { | 136 | ast::EnumVariant(it) => { |
137 | Some(NavigationTarget::from_named( | 137 | Some(NavigationTarget::from_named( |
138 | db, | 138 | db, |
139 | node.with_ast(&it), | 139 | node.with_value(&it), |
140 | it.doc_comment_text(), | 140 | it.doc_comment_text(), |
141 | it.short_label(), | 141 | it.short_label(), |
142 | )) | 142 | )) |
@@ -144,7 +144,7 @@ fn named_target(db: &RootDatabase, node: Source<&SyntaxNode>) -> Option<Navigati | |||
144 | ast::FnDef(it) => { | 144 | ast::FnDef(it) => { |
145 | Some(NavigationTarget::from_named( | 145 | Some(NavigationTarget::from_named( |
146 | db, | 146 | db, |
147 | node.with_ast(&it), | 147 | node.with_value(&it), |
148 | it.doc_comment_text(), | 148 | it.doc_comment_text(), |
149 | it.short_label(), | 149 | it.short_label(), |
150 | )) | 150 | )) |
@@ -152,7 +152,7 @@ fn named_target(db: &RootDatabase, node: Source<&SyntaxNode>) -> Option<Navigati | |||
152 | ast::TypeAliasDef(it) => { | 152 | ast::TypeAliasDef(it) => { |
153 | Some(NavigationTarget::from_named( | 153 | Some(NavigationTarget::from_named( |
154 | db, | 154 | db, |
155 | node.with_ast(&it), | 155 | node.with_value(&it), |
156 | it.doc_comment_text(), | 156 | it.doc_comment_text(), |
157 | it.short_label(), | 157 | it.short_label(), |
158 | )) | 158 | )) |
@@ -160,7 +160,7 @@ fn named_target(db: &RootDatabase, node: Source<&SyntaxNode>) -> Option<Navigati | |||
160 | ast::ConstDef(it) => { | 160 | ast::ConstDef(it) => { |
161 | Some(NavigationTarget::from_named( | 161 | Some(NavigationTarget::from_named( |
162 | db, | 162 | db, |
163 | node.with_ast(&it), | 163 | node.with_value(&it), |
164 | it.doc_comment_text(), | 164 | it.doc_comment_text(), |
165 | it.short_label(), | 165 | it.short_label(), |
166 | )) | 166 | )) |
@@ -168,7 +168,7 @@ fn named_target(db: &RootDatabase, node: Source<&SyntaxNode>) -> Option<Navigati | |||
168 | ast::StaticDef(it) => { | 168 | ast::StaticDef(it) => { |
169 | Some(NavigationTarget::from_named( | 169 | Some(NavigationTarget::from_named( |
170 | db, | 170 | db, |
171 | node.with_ast(&it), | 171 | node.with_value(&it), |
172 | it.doc_comment_text(), | 172 | it.doc_comment_text(), |
173 | it.short_label(), | 173 | it.short_label(), |
174 | )) | 174 | )) |
@@ -176,7 +176,7 @@ fn named_target(db: &RootDatabase, node: Source<&SyntaxNode>) -> Option<Navigati | |||
176 | ast::TraitDef(it) => { | 176 | ast::TraitDef(it) => { |
177 | Some(NavigationTarget::from_named( | 177 | Some(NavigationTarget::from_named( |
178 | db, | 178 | db, |
179 | node.with_ast(&it), | 179 | node.with_value(&it), |
180 | it.doc_comment_text(), | 180 | it.doc_comment_text(), |
181 | it.short_label(), | 181 | it.short_label(), |
182 | )) | 182 | )) |
@@ -184,7 +184,7 @@ fn named_target(db: &RootDatabase, node: Source<&SyntaxNode>) -> Option<Navigati | |||
184 | ast::RecordFieldDef(it) => { | 184 | ast::RecordFieldDef(it) => { |
185 | Some(NavigationTarget::from_named( | 185 | Some(NavigationTarget::from_named( |
186 | db, | 186 | db, |
187 | node.with_ast(&it), | 187 | node.with_value(&it), |
188 | it.doc_comment_text(), | 188 | it.doc_comment_text(), |
189 | it.short_label(), | 189 | it.short_label(), |
190 | )) | 190 | )) |
@@ -192,7 +192,7 @@ fn named_target(db: &RootDatabase, node: Source<&SyntaxNode>) -> Option<Navigati | |||
192 | ast::Module(it) => { | 192 | ast::Module(it) => { |
193 | Some(NavigationTarget::from_named( | 193 | Some(NavigationTarget::from_named( |
194 | db, | 194 | db, |
195 | node.with_ast(&it), | 195 | node.with_value(&it), |
196 | it.doc_comment_text(), | 196 | it.doc_comment_text(), |
197 | it.short_label(), | 197 | it.short_label(), |
198 | )) | 198 | )) |
@@ -200,7 +200,7 @@ fn named_target(db: &RootDatabase, node: Source<&SyntaxNode>) -> Option<Navigati | |||
200 | ast::MacroCall(it) => { | 200 | ast::MacroCall(it) => { |
201 | Some(NavigationTarget::from_named( | 201 | Some(NavigationTarget::from_named( |
202 | db, | 202 | db, |
203 | node.with_ast(&it), | 203 | node.with_value(&it), |
204 | it.doc_comment_text(), | 204 | it.doc_comment_text(), |
205 | None, | 205 | None, |
206 | )) | 206 | )) |