From ee8d7a71237888eeddf00b69c46d1fd6db9028df Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 21 Dec 2020 15:38:27 +0100 Subject: [PATCH] Filter out empty rustc spans --- crates/rust-analyzer/src/diagnostics/to_proto.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/rust-analyzer/src/diagnostics/to_proto.rs b/crates/rust-analyzer/src/diagnostics/to_proto.rs index f16f97131e9..54075919875 100644 --- a/crates/rust-analyzer/src/diagnostics/to_proto.rs +++ b/crates/rust-analyzer/src/diagnostics/to_proto.rs @@ -319,6 +319,10 @@ pub(crate) fn map_rust_diagnostic_to_lsp( message: "original diagnostic".to_string(), }; for info in &related_information { + // Filter out empty/non-existent messages, as they greatly confuse VS Code. + if info.message.is_empty() { + continue; + } diagnostics.push(MappedRustDiagnostic { url: info.location.uri.clone(), fixes: fixes.clone(), // share fixes to make them easier to apply