aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_ide_api/src/lib.rs2
-rw-r--r--crates/ra_ide_api/src/navigation_target.rs23
2 files changed, 11 insertions, 14 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 2e1768951..9c5a82187 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -243,7 +243,7 @@ impl Query {
243 } 243 }
244} 244}
245 245
246/// `NavigationTarget` represents and element in the editor's UI whihc you can 246/// `NavigationTarget` represents and element in the editor's UI which you can
247/// click on to navigate to a particular piece of code. 247/// click on to navigate to a particular piece of code.
248/// 248///
249/// Typically, a `NavigationTarget` corresponds to some element in the source 249/// Typically, a `NavigationTarget` corresponds to some element in the source
diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs
index bacb7329f..eaf46fd01 100644
--- a/crates/ra_ide_api/src/navigation_target.rs
+++ b/crates/ra_ide_api/src/navigation_target.rs
@@ -19,19 +19,6 @@ impl NavigationTarget {
19 } 19 }
20 } 20 }
21 21
22 pub(crate) fn from_syntax(
23 name: Option<Name>,
24 file_id: FileId,
25 node: &SyntaxNode,
26 ) -> NavigationTarget {
27 NavigationTarget {
28 file_id,
29 name: name.map(|n| n.to_string().into()).unwrap_or("".into()),
30 kind: node.kind(),
31 range: node.range(),
32 ptr: Some(LocalSyntaxPtr::new(node)),
33 }
34 }
35 // TODO once Def::Item is gone, this should be able to always return a NavigationTarget 22 // TODO once Def::Item is gone, this should be able to always return a NavigationTarget
36 pub(crate) fn from_def(db: &RootDatabase, def: Def) -> Cancelable<Option<NavigationTarget>> { 23 pub(crate) fn from_def(db: &RootDatabase, def: Def) -> Cancelable<Option<NavigationTarget>> {
37 Ok(match def { 24 Ok(match def {
@@ -83,4 +70,14 @@ impl NavigationTarget {
83 Def::Item => None, 70 Def::Item => None,
84 }) 71 })
85 } 72 }
73
74 fn from_syntax(name: Option<Name>, file_id: FileId, node: &SyntaxNode) -> NavigationTarget {
75 NavigationTarget {
76 file_id,
77 name: name.map(|n| n.to_string().into()).unwrap_or("".into()),
78 kind: node.kind(),
79 range: node.range(),
80 ptr: Some(LocalSyntaxPtr::new(node)),
81 }
82 }
86} 83}