mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
More principled approach for gotodef for field shorhand
Callers can now decide for themselves if they should prefer field or local definition. By default, it's the local.
This commit is contained in:
parent
96eca8a1ab
commit
2716a1fa3f
7 changed files with 79 additions and 36 deletions
|
@ -153,7 +153,7 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn
|
|||
if let Some((node, name_kind)) = match_ast! {
|
||||
match (token.parent()) {
|
||||
ast::NameRef(name_ref) => {
|
||||
classify_name_ref(&sema, &name_ref).map(|d| (name_ref.syntax().clone(), d))
|
||||
classify_name_ref(&sema, &name_ref).map(|d| (name_ref.syntax().clone(), d.definition()))
|
||||
},
|
||||
ast::Name(name) => {
|
||||
classify_name(&sema, &name).map(|d| (name.syntax().clone(), d.definition()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue