Fix goto def not working when cursor was over the name of a def
We now allow goto_definition to return the named NavigationTarget if the cursor is on the name of a definition.
This commit is contained in:
@@ -198,7 +198,8 @@ impl NavigationTarget {
|
||||
buf
|
||||
}
|
||||
|
||||
fn from_named(file_id: FileId, node: &impl ast::NameOwner) -> NavigationTarget {
|
||||
/// Allows `NavigationTarget` to be created from a `NameOwner`
|
||||
pub(crate) fn from_named(file_id: FileId, node: &impl ast::NameOwner) -> NavigationTarget {
|
||||
let name = node.name().map(|it| it.text().clone()).unwrap_or_default();
|
||||
let focus_range = node.name().map(|it| it.syntax().range());
|
||||
NavigationTarget::from_syntax(file_id, name, focus_range, node.syntax())
|
||||
|
||||
Reference in New Issue
Block a user