From 5d0c1aa1625a17723209e537590dc7fc7f181df1 Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 3 Jun 2020 15:13:26 +0300 Subject: Rebase on the latest master. --- crates/ra_ide/src/hover.rs | 6 +++--- crates/rust-analyzer/src/main_loop/handlers.rs | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'crates') 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; }; } } #[test] - fn test_hover_trait_hash_impl_action() { + fn test_hover_trait_has_impl_action() { let (_, actions) = check_hover_result( " //- /lib.rs @@ -1139,7 +1139,7 @@ fn func(foo: i32) { if true { <|>foo; }; } } #[test] - fn test_hover_struct_hash_impl_action() { + fn test_hover_struct_has_impl_action() { let (_, actions) = check_hover_result( " //- /lib.rs @@ -1151,7 +1151,7 @@ fn func(foo: i32) { if true { <|>foo; }; } } #[test] - fn test_hover_union_hash_impl_action() { + fn test_hover_union_has_impl_action() { let (_, actions) = check_hover_result( " //- /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( value: crate::markdown::format_docs(&info.info.to_markup()), }), range: Some(range), - actions: Some(prepare_hover_actions(&world, info.info.actions())), + actions: Some(prepare_hover_actions(&snap, info.info.actions())), }; Ok(Some(res)) } @@ -1176,18 +1176,18 @@ fn to_command_link(command: Command, tooltip: String) -> lsp_ext::CommandLink { } fn show_impl_command_link( - world: &WorldSnapshot, + snap: &GlobalStateSnapshot, position: &FilePosition, ) -> Option { - if world.config.hover.implementations { - if let Some(nav_data) = world.analysis().goto_implementation(*position).unwrap_or(None) { - let uri = to_proto::url(world, position.file_id).ok()?; - let line_index = world.analysis().file_line_index(position.file_id).ok()?; + if snap.config.hover.implementations { + if let Some(nav_data) = snap.analysis().goto_implementation(*position).unwrap_or(None) { + let uri = to_proto::url(snap, position.file_id).ok()?; + let line_index = snap.analysis().file_line_index(position.file_id).ok()?; let position = to_proto::position(&line_index, position.offset); let locations: Vec<_> = nav_data .info .iter() - .filter_map(|it| to_proto::location(world, it.file_range()).ok()) + .filter_map(|it| to_proto::location(snap, it.file_range()).ok()) .collect(); let title = implementation_title(locations.len()); let command = show_references_command(title, &uri, position, locations); @@ -1202,17 +1202,17 @@ fn show_impl_command_link( } fn prepare_hover_actions( - world: &WorldSnapshot, + snap: &GlobalStateSnapshot, actions: &[HoverAction], ) -> Vec { - if world.config.hover.none() || !world.config.client_caps.hover_actions { + if snap.config.hover.none() || !snap.config.client_caps.hover_actions { return Vec::new(); } actions .iter() .filter_map(|it| match it { - HoverAction::Implementaion(position) => show_impl_command_link(world, position), + HoverAction::Implementaion(position) => show_impl_command_link(snap, position), }) .collect() } -- cgit v1.2.3