From f8261d611a60e99bc188022773f84912972208d2 Mon Sep 17 00:00:00 2001 From: Marcus Klaas de Vries Date: Tue, 8 Jan 2019 23:38:51 +0100 Subject: [PATCH] Fix typo defenition -> definition --- crates/ra_hir/src/code_model_api.rs | 4 ++-- crates/ra_hir/src/code_model_impl/module.rs | 2 +- crates/ra_hir/src/impl_block.rs | 2 +- .../src/completion/complete_scope.rs | 2 +- ...{goto_defenition.rs => goto_definition.rs} | 22 +++++++++---------- crates/ra_ide_api/src/hover.rs | 2 +- crates/ra_ide_api/src/lib.rs | 6 ++--- .../ra_lsp_server/src/main_loop/handlers.rs | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) rename crates/ra_ide_api/src/{goto_defenition.rs => goto_definition.rs} (86%) diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index 902032e1411..343d06a5b22 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 { } /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items. - pub fn defenition_source(&self, db: &impl HirDatabase) -> Cancelable<(FileId, ModuleSource)> { - self.defenition_source_impl(db) + pub fn definition_source(&self, db: &impl HirDatabase) -> Cancelable<(FileId, ModuleSource)> { + self.definition_source_impl(db) } /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`. /// `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 56e14fac128..1cb408cff6c 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 { Ok(Some(link.name(&module_tree).clone())) } - pub fn defenition_source_impl( + pub fn definition_source_impl( &self, db: &impl HirDatabase, ) -> Cancelable<(FileId, ModuleSource)> { diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs index bb0ad84e47e..0fbbdc8eb50 100644 --- a/crates/ra_hir/src/impl_block.rs +++ b/crates/ra_hir/src/impl_block.rs @@ -150,7 +150,7 @@ impl ModuleImplBlocks { } fn collect(&mut self, db: &impl HirDatabase, module: Module) -> Cancelable<()> { - let (file_id, module_source) = module.defenition_source(db)?; + let (file_id, module_source) = module.definition_source(db)?; let node = match &module_source { ModuleSource::SourceFile(node) => node.syntax(), 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 ee9052d3d5d..770a0fdf270 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) -> } let module_scope = module.scope(ctx.db)?; - let (file_id, _) = module.defenition_source(ctx.db)?; + let (file_id, _) = module.definition_source(ctx.db)?; module_scope .entries() .filter(|(_name, res)| { diff --git a/crates/ra_ide_api/src/goto_defenition.rs b/crates/ra_ide_api/src/goto_definition.rs similarity index 86% rename from crates/ra_ide_api/src/goto_defenition.rs rename to crates/ra_ide_api/src/goto_definition.rs index fcd8d315e24..0d524b6f1da 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::{ use crate::{FilePosition, NavigationTarget, db::RootDatabase}; -pub(crate) fn goto_defenition( +pub(crate) fn goto_definition( db: &RootDatabase, position: FilePosition, ) -> Cancelable>> { let file = db.source_file(position.file_id); let syntax = file.syntax(); if let Some(name_ref) = find_node_at_offset::(syntax, position.offset) { - return Ok(Some(reference_defenition(db, position.file_id, name_ref)?)); + return Ok(Some(reference_definition(db, position.file_id, name_ref)?)); } if let Some(name) = find_node_at_offset::(syntax, position.offset) { - return name_defenition(db, position.file_id, name); + return name_definition(db, position.file_id, name); } Ok(None) } -pub(crate) fn reference_defenition( +pub(crate) fn reference_definition( db: &RootDatabase, file_id: FileId, name_ref: &ast::NameRef, @@ -51,7 +51,7 @@ pub(crate) fn reference_defenition( Ok(navs) } -fn name_defenition( +fn name_definition( db: &RootDatabase, file_id: FileId, name: &ast::Name, @@ -61,7 +61,7 @@ fn name_defenition( if let Some(child_module) = hir::source_binder::module_from_declaration(db, file_id, module)? { - let (file_id, _) = child_module.defenition_source(db)?; + let (file_id, _) = child_module.definition_source(db)?; let name = match child_module.name(db)? { Some(name) => name.to_string().into(), None => "".into(), @@ -86,7 +86,7 @@ mod tests { use crate::mock_analysis::analysis_and_position; #[test] - fn goto_defenition_works_in_items() { + fn goto_definition_works_in_items() { let (analysis, pos) = analysis_and_position( " //- /lib.rs @@ -95,7 +95,7 @@ mod tests { ", ); - let symbols = analysis.goto_defenition(pos).unwrap().unwrap(); + let symbols = analysis.goto_definition(pos).unwrap().unwrap(); assert_eq_dbg( r#"[NavigationTarget { file_id: FileId(1), name: "Foo", kind: STRUCT_DEF, range: [0; 11), @@ -105,7 +105,7 @@ mod tests { } #[test] - fn goto_defenition_works_for_module_declaration() { + fn goto_definition_works_for_module_declaration() { let (analysis, pos) = analysis_and_position( " //- /lib.rs @@ -115,7 +115,7 @@ mod tests { ", ); - let symbols = analysis.goto_defenition(pos).unwrap().unwrap(); + let symbols = analysis.goto_definition(pos).unwrap().unwrap(); assert_eq_dbg( r#"[NavigationTarget { file_id: FileId(2), name: "foo", kind: MODULE, range: [0; 0), ptr: None }]"#, &symbols, @@ -130,7 +130,7 @@ mod tests { ", ); - let symbols = analysis.goto_defenition(pos).unwrap().unwrap(); + let symbols = analysis.goto_definition(pos).unwrap().unwrap(); assert_eq_dbg( r#"[NavigationTarget { file_id: FileId(2), name: "foo", kind: MODULE, range: [0; 0), ptr: None }]"#, &symbols, diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index 475524ee182..41309e7562f 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( let mut range = None; if let Some(name_ref) = find_node_at_offset::(file.syntax(), position.offset) { - let navs = crate::goto_defenition::reference_defenition(db, position.file_id, name_ref)?; + let navs = crate::goto_definition::reference_definition(db, position.file_id, name_ref)?; for nav in navs { res.extend(doc_text_for(db, nav)?) } diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index 7e9ca20341e..76273126892 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs @@ -20,7 +20,7 @@ macro_rules! ctry { mod completion; mod db; -mod goto_defenition; +mod goto_definition; mod imp; pub mod mock_analysis; mod runnables; @@ -399,11 +399,11 @@ impl Analysis { .collect(); Ok(res) } - pub fn goto_defenition( + pub fn goto_definition( &self, position: FilePosition, ) -> Cancelable>> { - goto_defenition::goto_defenition(&*self.db, position) + goto_definition::goto_definition(&*self.db, position) } /// Finds all usages of the reference at point. pub fn find_all_refs(&self, position: FilePosition) -> Cancelable> { diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index a653c5ada0b..069e7f932d1 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( params: req::TextDocumentPositionParams, ) -> Result> { let position = params.try_conv_with(&world)?; - let navs = match world.analysis().goto_defenition(position)? { + let navs = match world.analysis().goto_definition(position)? { None => return Ok(None), Some(it) => it, };