aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/display/navigation_target.rs12
-rw-r--r--crates/ide/src/goto_definition.rs1
-rw-r--r--crates/ide/src/parent_module.rs10
3 files changed, 13 insertions, 10 deletions
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs
index 23d885218..198243466 100644
--- a/crates/ide/src/display/navigation_target.rs
+++ b/crates/ide/src/display/navigation_target.rs
@@ -85,12 +85,16 @@ impl NavigationTarget {
85 let name = module.name(db).map(|it| it.to_string().into()).unwrap_or_default(); 85 let name = module.name(db).map(|it| it.to_string().into()).unwrap_or_default();
86 if let Some(src) = module.declaration_source(db) { 86 if let Some(src) = module.declaration_source(db) {
87 let node = src.as_ref().map(|it| it.syntax()); 87 let node = src.as_ref().map(|it| it.syntax());
88 let frange = node.original_file_range(db); 88 let full_range = node.original_file_range(db);
89 let focus_range = src
90 .value
91 .name()
92 .map(|name| src.with_value(name.syntax()).original_file_range(db).range);
89 let mut res = NavigationTarget::from_syntax( 93 let mut res = NavigationTarget::from_syntax(
90 frange.file_id, 94 full_range.file_id,
91 name, 95 name,
92 None, 96 focus_range,
93 frange.range, 97 full_range.range,
94 SymbolKind::Module, 98 SymbolKind::Module,
95 ); 99 );
96 res.docs = module.attrs(db).docs(); 100 res.docs = module.attrs(db).docs();
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs
index c91eb1283..e86ae2a18 100644
--- a/crates/ide/src/goto_definition.rs
+++ b/crates/ide/src/goto_definition.rs
@@ -131,7 +131,6 @@ pub(crate) fn reference_definition(
131#[cfg(test)] 131#[cfg(test)]
132mod tests { 132mod tests {
133 use ide_db::base_db::FileRange; 133 use ide_db::base_db::FileRange;
134 use syntax::{TextRange, TextSize};
135 134
136 use crate::fixture; 135 use crate::fixture;
137 136
diff --git a/crates/ide/src/parent_module.rs b/crates/ide/src/parent_module.rs
index e5515ef2c..7b08bc27b 100644
--- a/crates/ide/src/parent_module.rs
+++ b/crates/ide/src/parent_module.rs
@@ -81,8 +81,8 @@ mod tests {
81 check( 81 check(
82 r#" 82 r#"
83//- /lib.rs 83//- /lib.rs
84 mod foo; 84mod foo;
85//^^^^^^^^ 85 //^^^
86 86
87//- /foo.rs 87//- /foo.rs
88$0// empty 88$0// empty
@@ -96,8 +96,8 @@ $0// empty
96 check( 96 check(
97 r#" 97 r#"
98//- /lib.rs 98//- /lib.rs
99 mod foo; 99mod foo;
100//^^^^^^^^ 100 //^^^
101//- /foo.rs 101//- /foo.rs
102mod $0bar; 102mod $0bar;
103 103
@@ -115,7 +115,7 @@ mod $0bar;
115mod foo { 115mod foo {
116 mod bar { 116 mod bar {
117 mod baz { $0 } 117 mod baz { $0 }
118 } //^^^^^^^^^^^^ 118 } //^^^
119} 119}
120"#, 120"#,
121 ); 121 );