diff --git a/crates/editor/src/hover_links.rs b/crates/editor/src/hover_links.rs index 7dad9f28e4b2767945f7f0aa4941c4862255c2a4..8177a4dca1607cff57cb513d743dd2e975b675d4 100644 --- a/crates/editor/src/hover_links.rs +++ b/crates/editor/src/hover_links.rs @@ -1862,4 +1862,42 @@ mod tests { cx.simulate_click(screen_coord, Modifiers::secondary_key()); cx.update_workspace(|workspace, _, cx| assert_eq!(workspace.items(cx).count(), 1)); } + + #[gpui::test] + async fn test_hover_unicode(cx: &mut gpui::TestAppContext) { + init_test(cx, |_| {}); + let mut cx = EditorLspTestContext::new_rust( + lsp::ServerCapabilities { + ..Default::default() + }, + cx, + ) + .await; + + cx.set_state(indoc! {" + You can't open ˇ\"🤩\" because it's an emoji. + "}); + + // File does not exist + let screen_coord = cx.pixel_position(indoc! {" + You can't open ˇ\"🤩\" because it's an emoji. + "}); + cx.simulate_mouse_move(screen_coord, None, Modifiers::secondary_key()); + + // No highlight, does not panic... + cx.update_editor(|editor, window, cx| { + assert!( + editor + .snapshot(window, cx) + .text_highlight_ranges::() + .unwrap_or_default() + .1 + .is_empty() + ); + }); + + // Does not open the directory + cx.simulate_click(screen_coord, Modifiers::secondary_key()); + cx.update_workspace(|workspace, _, cx| assert_eq!(workspace.items(cx).count(), 1)); + } }