aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/imp.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-11 11:00:54 +0000
committerAleksey Kladov <[email protected]>2019-01-11 13:01:57 +0000
commitf9ed8d4d23cd210f24ca303c72b436bfbe84741f (patch)
tree0fc1e57980421ff42e68f5ee8dc699a38dc0fbb4 /crates/ra_ide_api/src/imp.rs
parent1d3d05d5d70943d8b1356a7e2c8d8b63a1ec470d (diff)
envapsulate navigation target better
Diffstat (limited to 'crates/ra_ide_api/src/imp.rs')
-rw-r--r--crates/ra_ide_api/src/imp.rs15
1 files changed, 2 insertions, 13 deletions
diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/imp.rs
index 7c60ab7d6..12bfe1761 100644
--- a/crates/ra_ide_api/src/imp.rs
+++ b/crates/ra_ide_api/src/imp.rs
@@ -11,7 +11,6 @@ use ra_syntax::{
11 TextRange, AstNode, SourceFile, 11 TextRange, AstNode, SourceFile,
12 ast::{self, NameOwner}, 12 ast::{self, NameOwner},
13 algo::find_node_at_offset, 13 algo::find_node_at_offset,
14 SyntaxKind::*,
15}; 14};
16 15
17use crate::{ 16use crate::{
@@ -109,18 +108,8 @@ impl db::RootDatabase {
109 None => return Ok(Vec::new()), 108 None => return Ok(Vec::new()),
110 Some(it) => it, 109 Some(it) => it,
111 }; 110 };
112 let (file_id, ast_module) = match module.declaration_source(self)? { 111 let nav = NavigationTarget::from_module(self, module)?;
113 None => return Ok(Vec::new()), 112 Ok(vec![nav])
114 Some(it) => it,
115 };
116 let name = ast_module.name().unwrap();
117 Ok(vec![NavigationTarget {
118 file_id,
119 name: name.text().clone(),
120 range: name.syntax().range(),
121 kind: MODULE,
122 ptr: None,
123 }])
124 } 113 }
125 /// Returns `Vec` for the same reason as `parent_module` 114 /// Returns `Vec` for the same reason as `parent_module`
126 pub(crate) fn crate_for(&self, file_id: FileId) -> Cancelable<Vec<CrateId>> { 115 pub(crate) fn crate_for(&self, file_id: FileId) -> Cancelable<Vec<CrateId>> {