aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-06-11 00:34:34 +0100
committerAleksey Kladov <[email protected]>2019-06-11 16:28:51 +0100
commit91c120ccea4f0cfef20fd4d918154c8152f83816 (patch)
treef175e9308486f8594618236d63737042f546b37a /crates/ra_ide_api/src
parente505fe9d7b96f3454711e923c70d763c5cee5f47 (diff)
introduce Source struct
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/display/navigation_target.rs20
-rw-r--r--crates/ra_ide_api/src/hover.rs11
2 files changed, 17 insertions, 14 deletions
diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs
index cfd3f5478..c02bc005b 100644
--- a/crates/ra_ide_api/src/display/navigation_target.rs
+++ b/crates/ra_ide_api/src/display/navigation_target.rs
@@ -189,12 +189,12 @@ impl NavigationTarget {
189 pub(crate) fn from_adt_def(db: &RootDatabase, adt_def: hir::AdtDef) -> NavigationTarget { 189 pub(crate) fn from_adt_def(db: &RootDatabase, adt_def: hir::AdtDef) -> NavigationTarget {
190 match adt_def { 190 match adt_def {
191 hir::AdtDef::Struct(s) => { 191 hir::AdtDef::Struct(s) => {
192 let (file_id, node) = s.source(db); 192 let src = s.source(db);
193 NavigationTarget::from_named( 193 NavigationTarget::from_named(
194 file_id.original_file(db), 194 src.file_id.original_file(db),
195 &*node, 195 &*src.ast,
196 node.doc_comment_text(), 196 src.ast.doc_comment_text(),
197 node.short_label(), 197 src.ast.short_label(),
198 ) 198 )
199 } 199 }
200 hir::AdtDef::Union(s) => { 200 hir::AdtDef::Union(s) => {
@@ -226,12 +226,12 @@ impl NavigationTarget {
226 hir::ModuleDef::Module(module) => NavigationTarget::from_module(db, module), 226 hir::ModuleDef::Module(module) => NavigationTarget::from_module(db, module),
227 hir::ModuleDef::Function(func) => NavigationTarget::from_function(db, func), 227 hir::ModuleDef::Function(func) => NavigationTarget::from_function(db, func),
228 hir::ModuleDef::Struct(s) => { 228 hir::ModuleDef::Struct(s) => {
229 let (file_id, node) = s.source(db); 229 let src = s.source(db);
230 NavigationTarget::from_named( 230 NavigationTarget::from_named(
231 file_id.original_file(db), 231 src.file_id.original_file(db),
232 &*node, 232 &*src.ast,
233 node.doc_comment_text(), 233 src.ast.doc_comment_text(),
234 node.short_label(), 234 src.ast.short_label(),
235 ) 235 )
236 } 236 }
237 hir::ModuleDef::Union(s) => { 237 hir::ModuleDef::Union(s) => {
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs
index fbabeb194..80445761c 100644
--- a/crates/ra_ide_api/src/hover.rs
+++ b/crates/ra_ide_api/src/hover.rs
@@ -136,8 +136,8 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn
136 res.extend(hover_text(it.doc_comment_text(), it.short_label())) 136 res.extend(hover_text(it.doc_comment_text(), it.short_label()))
137 } 137 }
138 hir::ModuleDef::Struct(it) => { 138 hir::ModuleDef::Struct(it) => {
139 let it = it.source(db).1; 139 let src = it.source(db);
140 res.extend(hover_text(it.doc_comment_text(), it.short_label())) 140 res.extend(hover_text(src.ast.doc_comment_text(), src.ast.short_label()))
141 } 141 }
142 hir::ModuleDef::Union(it) => { 142 hir::ModuleDef::Union(it) => {
143 let it = it.source(db).1; 143 let it = it.source(db).1;
@@ -176,8 +176,11 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn
176 if let Some((adt_def, _)) = ty.as_adt() { 176 if let Some((adt_def, _)) = ty.as_adt() {
177 match adt_def { 177 match adt_def {
178 hir::AdtDef::Struct(it) => { 178 hir::AdtDef::Struct(it) => {
179 let it = it.source(db).1; 179 let src = it.source(db);
180 res.extend(hover_text(it.doc_comment_text(), it.short_label())) 180 res.extend(hover_text(
181 src.ast.doc_comment_text(),
182 src.ast.short_label(),
183 ))
181 } 184 }
182 hir::AdtDef::Union(it) => { 185 hir::AdtDef::Union(it) => {
183 let it = it.source(db).1; 186 let it = it.source(db).1;