diff options
Diffstat (limited to 'crates/ide/src/display')
-rw-r--r-- | crates/ide/src/display/navigation_target.rs | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index 4eecae697..685052e7f 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs | |||
@@ -400,24 +400,33 @@ impl TryToNav for hir::GenericParam { | |||
400 | impl ToNav for hir::Local { | 400 | impl ToNav for hir::Local { |
401 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { | 401 | fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { |
402 | let src = self.source(db); | 402 | let src = self.source(db); |
403 | let node = match &src.value { | 403 | let (node, focus_range) = match &src.value { |
404 | Either::Left(bind_pat) => { | 404 | Either::Left(bind_pat) => ( |
405 | bind_pat.name().map_or_else(|| bind_pat.syntax().clone(), |it| it.syntax().clone()) | 405 | bind_pat.syntax().clone(), |
406 | } | 406 | bind_pat |
407 | Either::Right(it) => it.syntax().clone(), | 407 | .name() |
408 | .map(|it| src.with_value(&it.syntax().clone()).original_file_range(db).range), | ||
409 | ), | ||
410 | Either::Right(it) => (it.syntax().clone(), it.self_token().map(|it| it.text_range())), | ||
408 | }; | 411 | }; |
409 | let full_range = src.with_value(&node).original_file_range(db); | 412 | let full_range = src.with_value(&node).original_file_range(db); |
410 | let name = match self.name(db) { | 413 | let name = match self.name(db) { |
411 | Some(it) => it.to_string().into(), | 414 | Some(it) => it.to_string().into(), |
412 | None => "".into(), | 415 | None => "".into(), |
413 | }; | 416 | }; |
414 | let kind = if self.is_param(db) { SymbolKind::ValueParam } else { SymbolKind::Local }; | 417 | let kind = if self.is_self(db) { |
418 | SymbolKind::SelfParam | ||
419 | } else if self.is_param(db) { | ||
420 | SymbolKind::ValueParam | ||
421 | } else { | ||
422 | SymbolKind::Local | ||
423 | }; | ||
415 | NavigationTarget { | 424 | NavigationTarget { |
416 | file_id: full_range.file_id, | 425 | file_id: full_range.file_id, |
417 | name, | 426 | name, |
418 | kind: Some(kind), | 427 | kind: Some(kind), |
419 | full_range: full_range.range, | 428 | full_range: full_range.range, |
420 | focus_range: None, | 429 | focus_range, |
421 | container_name: None, | 430 | container_name: None, |
422 | description: None, | 431 | description: None, |
423 | docs: None, | 432 | docs: None, |