aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/imp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/imp.rs')
-rw-r--r--crates/ra_ide_api/src/imp.rs26
1 files changed, 1 insertions, 25 deletions
diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/imp.rs
index 7c60ab7d6..ba4aa0fd5 100644
--- a/crates/ra_ide_api/src/imp.rs
+++ b/crates/ra_ide_api/src/imp.rs
@@ -11,12 +11,11 @@ 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::{
18 AnalysisChange, 17 AnalysisChange,
19 Cancelable, NavigationTarget, 18 Cancelable,
20 CrateId, db, Diagnostic, FileId, FilePosition, FileRange, FileSystemEdit, 19 CrateId, db, Diagnostic, FileId, FilePosition, FileRange, FileSystemEdit,
21 Query, RootChange, SourceChange, SourceFileEdit, 20 Query, RootChange, SourceChange, SourceFileEdit,
22 symbol_index::{LibrarySymbolsQuery, FileSymbol}, 21 symbol_index::{LibrarySymbolsQuery, FileSymbol},
@@ -99,29 +98,6 @@ impl db::RootDatabase {
99} 98}
100 99
101impl db::RootDatabase { 100impl db::RootDatabase {
102 /// This returns `Vec` because a module may be included from several places. We
103 /// don't handle this case yet though, so the Vec has length at most one.
104 pub(crate) fn parent_module(
105 &self,
106 position: FilePosition,
107 ) -> Cancelable<Vec<NavigationTarget>> {
108 let module = match source_binder::module_from_position(self, position)? {
109 None => return Ok(Vec::new()),
110 Some(it) => it,
111 };
112 let (file_id, ast_module) = match module.declaration_source(self)? {
113 None => return Ok(Vec::new()),
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 }
125 /// Returns `Vec` for the same reason as `parent_module` 101 /// Returns `Vec` for the same reason as `parent_module`
126 pub(crate) fn crate_for(&self, file_id: FileId) -> Cancelable<Vec<CrateId>> { 102 pub(crate) fn crate_for(&self, file_id: FileId) -> Cancelable<Vec<CrateId>> {
127 let module = match source_binder::module_from_file_id(self, file_id)? { 103 let module = match source_binder::module_from_file_id(self, file_id)? {