Skip to content

Commit

Permalink
Auto merge of rust-lang#12440 - Maan2003:empty-msg-diag, r=jonas-schi…
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Jun 1, 2022
2 parents 4f5c7aa + bad9311 commit cf10a1e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions crates/rust-analyzer/src/diagnostics/to_proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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,
Expand Down

0 comments on commit cf10a1e

Please sign in to comment.