From 2a3abe2ce3ebaa0411012cc1be6829c9cb6ea16f Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Sat, 23 Feb 2019 11:02:42 +0200 Subject: 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. --- crates/ra_ide_api/src/navigation_target.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'crates/ra_ide_api/src/navigation_target.rs') diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs index fd001179a..e9240283e 100644 --- a/crates/ra_ide_api/src/navigation_target.rs +++ b/crates/ra_ide_api/src/navigation_target.rs @@ -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()) -- cgit v1.2.3