aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_ide/src/hover.rs6
-rw-r--r--crates/rust-analyzer/src/main_loop/handlers.rs20
2 files changed, 13 insertions, 13 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index 2b9095a82..2fbe0ba1f 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -1127,7 +1127,7 @@ fn func(foo: i32) { if true { <|>foo; }; }
1127 } 1127 }
1128 1128
1129 #[test] 1129 #[test]
1130 fn test_hover_trait_hash_impl_action() { 1130 fn test_hover_trait_has_impl_action() {
1131 let (_, actions) = check_hover_result( 1131 let (_, actions) = check_hover_result(
1132 " 1132 "
1133 //- /lib.rs 1133 //- /lib.rs
@@ -1139,7 +1139,7 @@ fn func(foo: i32) { if true { <|>foo; }; }
1139 } 1139 }
1140 1140
1141 #[test] 1141 #[test]
1142 fn test_hover_struct_hash_impl_action() { 1142 fn test_hover_struct_has_impl_action() {
1143 let (_, actions) = check_hover_result( 1143 let (_, actions) = check_hover_result(
1144 " 1144 "
1145 //- /lib.rs 1145 //- /lib.rs
@@ -1151,7 +1151,7 @@ fn func(foo: i32) { if true { <|>foo; }; }
1151 } 1151 }
1152 1152
1153 #[test] 1153 #[test]
1154 fn test_hover_union_hash_impl_action() { 1154 fn test_hover_union_has_impl_action() {
1155 let (_, actions) = check_hover_result( 1155 let (_, actions) = check_hover_result(
1156 " 1156 "
1157 //- /lib.rs 1157 //- /lib.rs
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs
index 0958a231f..d998d9ddd 100644
--- a/crates/rust-analyzer/src/main_loop/handlers.rs
+++ b/crates/rust-analyzer/src/main_loop/handlers.rs
@@ -553,7 +553,7 @@ pub fn handle_hover(
553 value: crate::markdown::format_docs(&info.info.to_markup()), 553 value: crate::markdown::format_docs(&info.info.to_markup()),
554 }), 554 }),
555 range: Some(range), 555 range: Some(range),
556 actions: Some(prepare_hover_actions(&world, info.info.actions())), 556 actions: Some(prepare_hover_actions(&snap, info.info.actions())),
557 }; 557 };
558 Ok(Some(res)) 558 Ok(Some(res))
559} 559}
@@ -1176,18 +1176,18 @@ fn to_command_link(command: Command, tooltip: String) -> lsp_ext::CommandLink {
1176} 1176}
1177 1177
1178fn show_impl_command_link( 1178fn show_impl_command_link(
1179 world: &WorldSnapshot, 1179 snap: &GlobalStateSnapshot,
1180 position: &FilePosition, 1180 position: &FilePosition,
1181) -> Option<lsp_ext::CommandLinkGroup> { 1181) -> Option<lsp_ext::CommandLinkGroup> {
1182 if world.config.hover.implementations { 1182 if snap.config.hover.implementations {
1183 if let Some(nav_data) = world.analysis().goto_implementation(*position).unwrap_or(None) { 1183 if let Some(nav_data) = snap.analysis().goto_implementation(*position).unwrap_or(None) {
1184 let uri = to_proto::url(world, position.file_id).ok()?; 1184 let uri = to_proto::url(snap, position.file_id).ok()?;
1185 let line_index = world.analysis().file_line_index(position.file_id).ok()?; 1185 let line_index = snap.analysis().file_line_index(position.file_id).ok()?;
1186 let position = to_proto::position(&line_index, position.offset); 1186 let position = to_proto::position(&line_index, position.offset);
1187 let locations: Vec<_> = nav_data 1187 let locations: Vec<_> = nav_data
1188 .info 1188 .info
1189 .iter() 1189 .iter()
1190 .filter_map(|it| to_proto::location(world, it.file_range()).ok()) 1190 .filter_map(|it| to_proto::location(snap, it.file_range()).ok())
1191 .collect(); 1191 .collect();
1192 let title = implementation_title(locations.len()); 1192 let title = implementation_title(locations.len());
1193 let command = show_references_command(title, &uri, position, locations); 1193 let command = show_references_command(title, &uri, position, locations);
@@ -1202,17 +1202,17 @@ fn show_impl_command_link(
1202} 1202}
1203 1203
1204fn prepare_hover_actions( 1204fn prepare_hover_actions(
1205 world: &WorldSnapshot, 1205 snap: &GlobalStateSnapshot,
1206 actions: &[HoverAction], 1206 actions: &[HoverAction],
1207) -> Vec<lsp_ext::CommandLinkGroup> { 1207) -> Vec<lsp_ext::CommandLinkGroup> {
1208 if world.config.hover.none() || !world.config.client_caps.hover_actions { 1208 if snap.config.hover.none() || !snap.config.client_caps.hover_actions {
1209 return Vec::new(); 1209 return Vec::new();
1210 } 1210 }
1211 1211
1212 actions 1212 actions
1213 .iter() 1213 .iter()
1214 .filter_map(|it| match it { 1214 .filter_map(|it| match it {
1215 HoverAction::Implementaion(position) => show_impl_command_link(world, position), 1215 HoverAction::Implementaion(position) => show_impl_command_link(snap, position),
1216 }) 1216 })
1217 .collect() 1217 .collect()
1218} 1218}