aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/navigation_target.rs
diff options
context:
space:
mode:
authorVille Penttinen <[email protected]>2019-02-23 09:02:42 +0000
committerVille Penttinen <[email protected]>2019-02-23 09:02:42 +0000
commit2a3abe2ce3ebaa0411012cc1be6829c9cb6ea16f (patch)
tree147fd0f4b97f8f560b061d0b1ba691e7233ecf5d /crates/ra_ide_api/src/navigation_target.rs
parent3d8a0982a12f3aa4b8c193a841f864b15c3cb66e (diff)
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.
Diffstat (limited to 'crates/ra_ide_api/src/navigation_target.rs')
-rw-r--r--crates/ra_ide_api/src/navigation_target.rs3
1 files changed, 2 insertions, 1 deletions
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 {
198 buf 198 buf
199 } 199 }
200 200
201 fn from_named(file_id: FileId, node: &impl ast::NameOwner) -> NavigationTarget { 201 /// Allows `NavigationTarget` to be created from a `NameOwner`
202 pub(crate) fn from_named(file_id: FileId, node: &impl ast::NameOwner) -> NavigationTarget {
202 let name = node.name().map(|it| it.text().clone()).unwrap_or_default(); 203 let name = node.name().map(|it| it.text().clone()).unwrap_or_default();
203 let focus_range = node.name().map(|it| it.syntax().range()); 204 let focus_range = node.name().map(|it| it.syntax().range());
204 NavigationTarget::from_syntax(file_id, name, focus_range, node.syntax()) 205 NavigationTarget::from_syntax(file_id, name, focus_range, node.syntax())