aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/code_model_api.rs4
-rw-r--r--crates/ra_hir/src/code_model_impl/module.rs2
-rw-r--r--crates/ra_hir/src/impl_block.rs2
-rw-r--r--crates/ra_ide_api/src/completion/complete_scope.rs2
-rw-r--r--crates/ra_ide_api/src/goto_definition.rs (renamed from crates/ra_ide_api/src/goto_defenition.rs)22
-rw-r--r--crates/ra_ide_api/src/hover.rs2
-rw-r--r--crates/ra_ide_api/src/lib.rs6
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs2
8 files changed, 21 insertions, 21 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs
index 902032e14..343d06a5b 100644
--- a/crates/ra_hir/src/code_model_api.rs
+++ b/crates/ra_hir/src/code_model_api.rs
@@ -75,8 +75,8 @@ impl Module {
75 } 75 }
76 76
77 /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items. 77 /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items.
78 pub fn defenition_source(&self, db: &impl HirDatabase) -> Cancelable<(FileId, ModuleSource)> { 78 pub fn definition_source(&self, db: &impl HirDatabase) -> Cancelable<(FileId, ModuleSource)> {
79 self.defenition_source_impl(db) 79 self.definition_source_impl(db)
80 } 80 }
81 /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`. 81 /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`.
82 /// `None` for the crate root. 82 /// `None` for the crate root.
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs
index 56e14fac1..1cb408cff 100644
--- a/crates/ra_hir/src/code_model_impl/module.rs
+++ b/crates/ra_hir/src/code_model_impl/module.rs
@@ -37,7 +37,7 @@ impl Module {
37 Ok(Some(link.name(&module_tree).clone())) 37 Ok(Some(link.name(&module_tree).clone()))
38 } 38 }
39 39
40 pub fn defenition_source_impl( 40 pub fn definition_source_impl(
41 &self, 41 &self,
42 db: &impl HirDatabase, 42 db: &impl HirDatabase,
43 ) -> Cancelable<(FileId, ModuleSource)> { 43 ) -> Cancelable<(FileId, ModuleSource)> {
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index bb0ad84e4..0fbbdc8eb 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -150,7 +150,7 @@ impl ModuleImplBlocks {
150 } 150 }
151 151
152 fn collect(&mut self, db: &impl HirDatabase, module: Module) -> Cancelable<()> { 152 fn collect(&mut self, db: &impl HirDatabase, module: Module) -> Cancelable<()> {
153 let (file_id, module_source) = module.defenition_source(db)?; 153 let (file_id, module_source) = module.definition_source(db)?;
154 let node = match &module_source { 154 let node = match &module_source {
155 ModuleSource::SourceFile(node) => node.syntax(), 155 ModuleSource::SourceFile(node) => node.syntax(),
156 ModuleSource::Module(node) => node.syntax(), 156 ModuleSource::Module(node) => node.syntax(),
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs
index ee9052d3d..770a0fdf2 100644
--- a/crates/ra_ide_api/src/completion/complete_scope.rs
+++ b/crates/ra_ide_api/src/completion/complete_scope.rs
@@ -20,7 +20,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) ->
20 } 20 }
21 21
22 let module_scope = module.scope(ctx.db)?; 22 let module_scope = module.scope(ctx.db)?;
23 let (file_id, _) = module.defenition_source(ctx.db)?; 23 let (file_id, _) = module.definition_source(ctx.db)?;
24 module_scope 24 module_scope
25 .entries() 25 .entries()
26 .filter(|(_name, res)| { 26 .filter(|(_name, res)| {
diff --git a/crates/ra_ide_api/src/goto_defenition.rs b/crates/ra_ide_api/src/goto_definition.rs
index fcd8d315e..0d524b6f1 100644
--- a/crates/ra_ide_api/src/goto_defenition.rs
+++ b/crates/ra_ide_api/src/goto_definition.rs
@@ -6,22 +6,22 @@ use ra_syntax::{
6 6
7use crate::{FilePosition, NavigationTarget, db::RootDatabase}; 7use crate::{FilePosition, NavigationTarget, db::RootDatabase};
8 8
9pub(crate) fn goto_defenition( 9pub(crate) fn goto_definition(
10 db: &RootDatabase, 10 db: &RootDatabase,
11 position: FilePosition, 11 position: FilePosition,
12) -> Cancelable<Option<Vec<NavigationTarget>>> { 12) -> Cancelable<Option<Vec<NavigationTarget>>> {
13 let file = db.source_file(position.file_id); 13 let file = db.source_file(position.file_id);
14 let syntax = file.syntax(); 14 let syntax = file.syntax();
15 if let Some(name_ref) = find_node_at_offset::<ast::NameRef>(syntax, position.offset) { 15 if let Some(name_ref) = find_node_at_offset::<ast::NameRef>(syntax, position.offset) {
16 return Ok(Some(reference_defenition(db, position.file_id, name_ref)?)); 16 return Ok(Some(reference_definition(db, position.file_id, name_ref)?));
17 } 17 }
18 if let Some(name) = find_node_at_offset::<ast::Name>(syntax, position.offset) { 18 if let Some(name) = find_node_at_offset::<ast::Name>(syntax, position.offset) {
19 return name_defenition(db, position.file_id, name); 19 return name_definition(db, position.file_id, name);
20 } 20 }
21 Ok(None) 21 Ok(None)
22} 22}
23 23
24pub(crate) fn reference_defenition( 24pub(crate) fn reference_definition(
25 db: &RootDatabase, 25 db: &RootDatabase,
26 file_id: FileId, 26 file_id: FileId,
27 name_ref: &ast::NameRef, 27 name_ref: &ast::NameRef,
@@ -51,7 +51,7 @@ pub(crate) fn reference_defenition(
51 Ok(navs) 51 Ok(navs)
52} 52}
53 53
54fn name_defenition( 54fn name_definition(
55 db: &RootDatabase, 55 db: &RootDatabase,
56 file_id: FileId, 56 file_id: FileId,
57 name: &ast::Name, 57 name: &ast::Name,
@@ -61,7 +61,7 @@ fn name_defenition(
61 if let Some(child_module) = 61 if let Some(child_module) =
62 hir::source_binder::module_from_declaration(db, file_id, module)? 62 hir::source_binder::module_from_declaration(db, file_id, module)?
63 { 63 {
64 let (file_id, _) = child_module.defenition_source(db)?; 64 let (file_id, _) = child_module.definition_source(db)?;
65 let name = match child_module.name(db)? { 65 let name = match child_module.name(db)? {
66 Some(name) => name.to_string().into(), 66 Some(name) => name.to_string().into(),
67 None => "".into(), 67 None => "".into(),
@@ -86,7 +86,7 @@ mod tests {
86 use crate::mock_analysis::analysis_and_position; 86 use crate::mock_analysis::analysis_and_position;
87 87
88 #[test] 88 #[test]
89 fn goto_defenition_works_in_items() { 89 fn goto_definition_works_in_items() {
90 let (analysis, pos) = analysis_and_position( 90 let (analysis, pos) = analysis_and_position(
91 " 91 "
92 //- /lib.rs 92 //- /lib.rs
@@ -95,7 +95,7 @@ mod tests {
95 ", 95 ",
96 ); 96 );
97 97
98 let symbols = analysis.goto_defenition(pos).unwrap().unwrap(); 98 let symbols = analysis.goto_definition(pos).unwrap().unwrap();
99 assert_eq_dbg( 99 assert_eq_dbg(
100 r#"[NavigationTarget { file_id: FileId(1), name: "Foo", 100 r#"[NavigationTarget { file_id: FileId(1), name: "Foo",
101 kind: STRUCT_DEF, range: [0; 11), 101 kind: STRUCT_DEF, range: [0; 11),
@@ -105,7 +105,7 @@ mod tests {
105 } 105 }
106 106
107 #[test] 107 #[test]
108 fn goto_defenition_works_for_module_declaration() { 108 fn goto_definition_works_for_module_declaration() {
109 let (analysis, pos) = analysis_and_position( 109 let (analysis, pos) = analysis_and_position(
110 " 110 "
111 //- /lib.rs 111 //- /lib.rs
@@ -115,7 +115,7 @@ mod tests {
115 ", 115 ",
116 ); 116 );
117 117
118 let symbols = analysis.goto_defenition(pos).unwrap().unwrap(); 118 let symbols = analysis.goto_definition(pos).unwrap().unwrap();
119 assert_eq_dbg( 119 assert_eq_dbg(
120 r#"[NavigationTarget { file_id: FileId(2), name: "foo", kind: MODULE, range: [0; 0), ptr: None }]"#, 120 r#"[NavigationTarget { file_id: FileId(2), name: "foo", kind: MODULE, range: [0; 0), ptr: None }]"#,
121 &symbols, 121 &symbols,
@@ -130,7 +130,7 @@ mod tests {
130 ", 130 ",
131 ); 131 );
132 132
133 let symbols = analysis.goto_defenition(pos).unwrap().unwrap(); 133 let symbols = analysis.goto_definition(pos).unwrap().unwrap();
134 assert_eq_dbg( 134 assert_eq_dbg(
135 r#"[NavigationTarget { file_id: FileId(2), name: "foo", kind: MODULE, range: [0; 0), ptr: None }]"#, 135 r#"[NavigationTarget { file_id: FileId(2), name: "foo", kind: MODULE, range: [0; 0), ptr: None }]"#,
136 &symbols, 136 &symbols,
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs
index 475524ee1..41309e756 100644
--- a/crates/ra_ide_api/src/hover.rs
+++ b/crates/ra_ide_api/src/hover.rs
@@ -16,7 +16,7 @@ pub(crate) fn hover(
16 16
17 let mut range = None; 17 let mut range = None;
18 if let Some(name_ref) = find_node_at_offset::<ast::NameRef>(file.syntax(), position.offset) { 18 if let Some(name_ref) = find_node_at_offset::<ast::NameRef>(file.syntax(), position.offset) {
19 let navs = crate::goto_defenition::reference_defenition(db, position.file_id, name_ref)?; 19 let navs = crate::goto_definition::reference_definition(db, position.file_id, name_ref)?;
20 for nav in navs { 20 for nav in navs {
21 res.extend(doc_text_for(db, nav)?) 21 res.extend(doc_text_for(db, nav)?)
22 } 22 }
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 7e9ca2034..762731268 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -20,7 +20,7 @@ macro_rules! ctry {
20 20
21mod completion; 21mod completion;
22mod db; 22mod db;
23mod goto_defenition; 23mod goto_definition;
24mod imp; 24mod imp;
25pub mod mock_analysis; 25pub mod mock_analysis;
26mod runnables; 26mod runnables;
@@ -399,11 +399,11 @@ impl Analysis {
399 .collect(); 399 .collect();
400 Ok(res) 400 Ok(res)
401 } 401 }
402 pub fn goto_defenition( 402 pub fn goto_definition(
403 &self, 403 &self,
404 position: FilePosition, 404 position: FilePosition,
405 ) -> Cancelable<Option<Vec<NavigationTarget>>> { 405 ) -> Cancelable<Option<Vec<NavigationTarget>>> {
406 goto_defenition::goto_defenition(&*self.db, position) 406 goto_definition::goto_definition(&*self.db, position)
407 } 407 }
408 /// Finds all usages of the reference at point. 408 /// Finds all usages of the reference at point.
409 pub fn find_all_refs(&self, position: FilePosition) -> Cancelable<Vec<(FileId, TextRange)>> { 409 pub fn find_all_refs(&self, position: FilePosition) -> Cancelable<Vec<(FileId, TextRange)>> {
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index a653c5ada..069e7f932 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -213,7 +213,7 @@ pub fn handle_goto_definition(
213 params: req::TextDocumentPositionParams, 213 params: req::TextDocumentPositionParams,
214) -> Result<Option<req::GotoDefinitionResponse>> { 214) -> Result<Option<req::GotoDefinitionResponse>> {
215 let position = params.try_conv_with(&world)?; 215 let position = params.try_conv_with(&world)?;
216 let navs = match world.analysis().goto_defenition(position)? { 216 let navs = match world.analysis().goto_definition(position)? {
217 None => return Ok(None), 217 None => return Ok(None),
218 Some(it) => it, 218 Some(it) => it,
219 }; 219 };