From bad931116ef40e237185c0b57ab4d6f138a4aad2 Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Wed, 1 Jun 2022 18:38:53 +0530 Subject: [PATCH] fix(diagnostic): Don't remove diagnostic with empty message Use " " as message if it is empty --- crates/rust-analyzer/src/diagnostics/to_proto.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/rust-analyzer/src/diagnostics/to_proto.rs b/crates/rust-analyzer/src/diagnostics/to_proto.rs index aac8e9222d..8f779df18d 100644 --- a/crates/rust-analyzer/src/diagnostics/to_proto.rs +++ b/crates/rust-analyzer/src/diagnostics/to_proto.rs @@ -462,9 +462,10 @@ pub(crate) fn map_rust_diagnostic_to_lsp( message: "original diagnostic".to_string(), }; for sub in &subdiagnostics { - // Filter out empty/non-existent messages, as they greatly confuse VS Code. - if sub.related.message.is_empty() { - continue; + let mut message = sub.related.message.clone(); + // Change empty message to " ", as they greatly confuse VS Code. + if message.is_empty() { + message = String::from(" "); } diagnostics.push(MappedRustDiagnostic { url: sub.related.location.uri.clone(), @@ -475,7 +476,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp( code: code.clone().map(lsp_types::NumberOrString::String), code_description: code_description.clone(), source: Some(source.clone()), - message: sub.related.message.clone(), + message, related_information: Some(vec![back_ref.clone()]), tags: None, // don't apply modifiers again data: None,