From f8939fd859fad1a5aa59aabb4b5da9ab033aa3f9 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Tue, 23 Jan 2024 10:34:38 +0100 Subject: [PATCH] Trim diagnostic messages to fix rendering bug Before this change a diagnostic message with a trailing newline (e.g. `line1\nline2\n`) would be rendered in a `Block` with `line_height: 2`. But the content we then display in this block had 3 "lines", which pushed the content out of the block. This fixes the issue by trimming the newlines at the end from the diagnostics. Co-authored-by: Antonio --- crates/project/src/project.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index de69a93ba6..88655c7fdc 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -3906,7 +3906,7 @@ impl Project { source: diagnostic.source.clone(), code: code.clone(), severity: diagnostic.severity.unwrap_or(DiagnosticSeverity::ERROR), - message: diagnostic.message.clone(), + message: diagnostic.message.trim().to_string(), group_id, is_primary: true, is_disk_based, @@ -3923,7 +3923,7 @@ impl Project { source: diagnostic.source.clone(), code: code.clone(), severity: DiagnosticSeverity::INFORMATION, - message: info.message.clone(), + message: info.message.trim().to_string(), group_id, is_primary: false, is_disk_based,