Skip to content

Commit f8261d6

Browse files
committed
Fix typo defenition -> definition
1 parent 46f74e3 commit f8261d6

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

crates/ra_hir/src/code_model_api.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ impl Module {
7575
}
7676

7777
/// 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)> {
79-
self.defenition_source_impl(db)
78+
pub fn definition_source(&self, db: &impl HirDatabase) -> Cancelable<(FileId, ModuleSource)> {
79+
self.definition_source_impl(db)
8080
}
8181
/// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`.
8282
/// `None` for the crate root.

crates/ra_hir/src/code_model_impl/module.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl Module {
3737
Ok(Some(link.name(&module_tree).clone()))
3838
}
3939

40-
pub fn defenition_source_impl(
40+
pub fn definition_source_impl(
4141
&self,
4242
db: &impl HirDatabase,
4343
) -> Cancelable<(FileId, ModuleSource)> {

crates/ra_hir/src/impl_block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl ModuleImplBlocks {
150150
}
151151

152152
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)?;
154154
let node = match &module_source {
155155
ModuleSource::SourceFile(node) => node.syntax(),
156156
ModuleSource::Module(node) => node.syntax(),

crates/ra_ide_api/src/completion/complete_scope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) ->
2020
}
2121

2222
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)?;
2424
module_scope
2525
.entries()
2626
.filter(|(_name, res)| {

crates/ra_ide_api/src/goto_defenition.rs renamed to crates/ra_ide_api/src/goto_definition.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ use ra_syntax::{
66

77
use crate::{FilePosition, NavigationTarget, db::RootDatabase};
88

9-
pub(crate) fn goto_defenition(
9+
pub(crate) fn goto_definition(
1010
db: &RootDatabase,
1111
position: FilePosition,
1212
) -> Cancelable<Option<Vec<NavigationTarget>>> {
1313
let file = db.source_file(position.file_id);
1414
let syntax = file.syntax();
1515
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)?));
1717
}
1818
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);
2020
}
2121
Ok(None)
2222
}
2323

24-
pub(crate) fn reference_defenition(
24+
pub(crate) fn reference_definition(
2525
db: &RootDatabase,
2626
file_id: FileId,
2727
name_ref: &ast::NameRef,
@@ -51,7 +51,7 @@ pub(crate) fn reference_defenition(
5151
Ok(navs)
5252
}
5353

54-
fn name_defenition(
54+
fn name_definition(
5555
db: &RootDatabase,
5656
file_id: FileId,
5757
name: &ast::Name,
@@ -61,7 +61,7 @@ fn name_defenition(
6161
if let Some(child_module) =
6262
hir::source_binder::module_from_declaration(db, file_id, module)?
6363
{
64-
let (file_id, _) = child_module.defenition_source(db)?;
64+
let (file_id, _) = child_module.definition_source(db)?;
6565
let name = match child_module.name(db)? {
6666
Some(name) => name.to_string().into(),
6767
None => "".into(),
@@ -86,7 +86,7 @@ mod tests {
8686
use crate::mock_analysis::analysis_and_position;
8787

8888
#[test]
89-
fn goto_defenition_works_in_items() {
89+
fn goto_definition_works_in_items() {
9090
let (analysis, pos) = analysis_and_position(
9191
"
9292
//- /lib.rs
@@ -95,7 +95,7 @@ mod tests {
9595
",
9696
);
9797

98-
let symbols = analysis.goto_defenition(pos).unwrap().unwrap();
98+
let symbols = analysis.goto_definition(pos).unwrap().unwrap();
9999
assert_eq_dbg(
100100
r#"[NavigationTarget { file_id: FileId(1), name: "Foo",
101101
kind: STRUCT_DEF, range: [0; 11),
@@ -105,7 +105,7 @@ mod tests {
105105
}
106106

107107
#[test]
108-
fn goto_defenition_works_for_module_declaration() {
108+
fn goto_definition_works_for_module_declaration() {
109109
let (analysis, pos) = analysis_and_position(
110110
"
111111
//- /lib.rs
@@ -115,7 +115,7 @@ mod tests {
115115
",
116116
);
117117

118-
let symbols = analysis.goto_defenition(pos).unwrap().unwrap();
118+
let symbols = analysis.goto_definition(pos).unwrap().unwrap();
119119
assert_eq_dbg(
120120
r#"[NavigationTarget { file_id: FileId(2), name: "foo", kind: MODULE, range: [0; 0), ptr: None }]"#,
121121
&symbols,
@@ -130,7 +130,7 @@ mod tests {
130130
",
131131
);
132132

133-
let symbols = analysis.goto_defenition(pos).unwrap().unwrap();
133+
let symbols = analysis.goto_definition(pos).unwrap().unwrap();
134134
assert_eq_dbg(
135135
r#"[NavigationTarget { file_id: FileId(2), name: "foo", kind: MODULE, range: [0; 0), ptr: None }]"#,
136136
&symbols,

crates/ra_ide_api/src/hover.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(crate) fn hover(
1616

1717
let mut range = None;
1818
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)?;
2020
for nav in navs {
2121
res.extend(doc_text_for(db, nav)?)
2222
}

crates/ra_ide_api/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ macro_rules! ctry {
2020

2121
mod completion;
2222
mod db;
23-
mod goto_defenition;
23+
mod goto_definition;
2424
mod imp;
2525
pub mod mock_analysis;
2626
mod runnables;
@@ -399,11 +399,11 @@ impl Analysis {
399399
.collect();
400400
Ok(res)
401401
}
402-
pub fn goto_defenition(
402+
pub fn goto_definition(
403403
&self,
404404
position: FilePosition,
405405
) -> Cancelable<Option<Vec<NavigationTarget>>> {
406-
goto_defenition::goto_defenition(&*self.db, position)
406+
goto_definition::goto_definition(&*self.db, position)
407407
}
408408
/// Finds all usages of the reference at point.
409409
pub fn find_all_refs(&self, position: FilePosition) -> Cancelable<Vec<(FileId, TextRange)>> {

crates/ra_lsp_server/src/main_loop/handlers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ pub fn handle_goto_definition(
213213
params: req::TextDocumentPositionParams,
214214
) -> Result<Option<req::GotoDefinitionResponse>> {
215215
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)? {
217217
None => return Ok(None),
218218
Some(it) => it,
219219
};

0 commit comments

Comments
 (0)