From fe4b345603c514e555f8081153b4afab3591f0b1 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Fri, 5 Apr 2024 15:59:37 -0700 Subject: [PATCH] Fix interpretation of \n in hovers (#10214) I ran into this specifically when looking at the documentation of https://crates.io/crates/wayland-client Release Notes: - Fixed a bug where some hover popovers would render `\n` instead of a new line. --- crates/editor/src/hover_popover.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/editor/src/hover_popover.rs b/crates/editor/src/hover_popover.rs index 6c27b0b3b05e095f81fecf958362e5eae124d54e..51de4abb049327a55c727974eee65189cdcaac3f 100644 --- a/crates/editor/src/hover_popover.rs +++ b/crates/editor/src/hover_popover.rs @@ -375,12 +375,12 @@ async fn parse_blocks( match &block.kind { HoverBlockKind::PlainText => { markdown::new_paragraph(&mut text, &mut Vec::new()); - text.push_str(&block.text); + text.push_str(&block.text.replace("\\n", "\n")); } HoverBlockKind::Markdown => { markdown::parse_markdown_block( - &block.text, + &block.text.replace("\\n", "\n"), language_registry, language.clone(), &mut text,