diff options
Diffstat (limited to 'crates/ra_ide/src/display')
-rw-r--r-- | crates/ra_ide/src/display/navigation_target.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 6a6b49afd..b9ae67828 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs | |||
@@ -328,22 +328,23 @@ impl ToNav for hir::AssocItem { | |||
328 | impl ToNav for hir::Local { | 328 | impl ToNav for hir::Local { |
329 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { | 329 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { |
330 | let src = self.source(db); | 330 | let src = self.source(db); |
331 | let (full_range, focus_range) = match src.value { | 331 | let node = match &src.value { |
332 | Either::Left(it) => { | 332 | Either::Left(bind_pat) => { |
333 | (it.syntax().text_range(), it.name().map(|it| it.syntax().text_range())) | 333 | bind_pat.name().map_or_else(|| bind_pat.syntax().clone(), |it| it.syntax().clone()) |
334 | } | 334 | } |
335 | Either::Right(it) => (it.syntax().text_range(), Some(it.self_kw_token().text_range())), | 335 | Either::Right(it) => it.syntax().clone(), |
336 | }; | 336 | }; |
337 | let full_range = original_range(db, src.with_value(&node)); | ||
337 | let name = match self.name(db) { | 338 | let name = match self.name(db) { |
338 | Some(it) => it.to_string().into(), | 339 | Some(it) => it.to_string().into(), |
339 | None => "".into(), | 340 | None => "".into(), |
340 | }; | 341 | }; |
341 | NavigationTarget { | 342 | NavigationTarget { |
342 | file_id: src.file_id.original_file(db), | 343 | file_id: full_range.file_id, |
343 | name, | 344 | name, |
344 | kind: BIND_PAT, | 345 | kind: BIND_PAT, |
345 | full_range, | 346 | full_range: full_range.range, |
346 | focus_range, | 347 | focus_range: None, |
347 | container_name: None, | 348 | container_name: None, |
348 | description: None, | 349 | description: None, |
349 | docs: None, | 350 | docs: None, |