aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/display
diff options
context:
space:
mode:
authorice1000 <[email protected]>2019-12-03 20:24:02 +0000
committerice1000 <[email protected]>2019-12-04 23:30:42 +0000
commit38853459e3d964cc7f635829cdc66f5faee33d85 (patch)
treec4e60a8f5fa9c18915e8aed7857424d454cd130e /crates/ra_ide/src/display
parent7cbedc50bcf048c87f141a85418581076d67fc7a (diff)
Add `ModuleSource::Block`
Diffstat (limited to 'crates/ra_ide/src/display')
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs43
1 files changed, 15 insertions, 28 deletions
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs
index f920d3db6..b376fcdae 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -231,34 +231,21 @@ impl ToNav for hir::Module {
231 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 231 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
232 let src = self.definition_source(db); 232 let src = self.definition_source(db);
233 let name = self.name(db).map(|it| it.to_string().into()).unwrap_or_default(); 233 let name = self.name(db).map(|it| it.to_string().into()).unwrap_or_default();
234 match &src.value { 234 let syntax = match &src.value {
235 ModuleSource::SourceFile(node) => { 235 ModuleSource::SourceFile(node) => node.syntax(),
236 let frange = original_range(db, src.with_value(node.syntax())); 236 ModuleSource::Module(node) => node.syntax(),
237 237 ModuleSource::Block(node) => node.syntax(),
238 NavigationTarget::from_syntax( 238 };
239 frange.file_id, 239 let frange = original_range(db, src.with_value(syntax));
240 name, 240 NavigationTarget::from_syntax(
241 None, 241 frange.file_id,
242 frange.range, 242 name,
243 node.syntax().kind(), 243 None,
244 None, 244 frange.range,
245 None, 245 syntax.kind(),
246 ) 246 None,
247 } 247 None,
248 ModuleSource::Module(node) => { 248 )
249 let frange = original_range(db, src.with_value(node.syntax()));
250
251 NavigationTarget::from_syntax(
252 frange.file_id,
253 name,
254 None,
255 frange.range,
256 node.syntax().kind(),
257 node.doc_comment_text(),
258 node.short_label(),
259 )
260 }
261 }
262 } 249 }
263} 250}
264 251