lsp: Gracefully ignore invalid diagnostic severity (#11569)

pull/11579/head
Lennard Hofmann 3 months ago committed by GitHub
parent 620dfceb84
commit af7a1fd20c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1920,12 +1920,15 @@ impl Document {
return None; return None;
}; };
let severity = diagnostic.severity.map(|severity| match severity { let severity = diagnostic.severity.and_then(|severity| match severity {
lsp::DiagnosticSeverity::ERROR => Error, lsp::DiagnosticSeverity::ERROR => Some(Error),
lsp::DiagnosticSeverity::WARNING => Warning, lsp::DiagnosticSeverity::WARNING => Some(Warning),
lsp::DiagnosticSeverity::INFORMATION => Info, lsp::DiagnosticSeverity::INFORMATION => Some(Info),
lsp::DiagnosticSeverity::HINT => Hint, lsp::DiagnosticSeverity::HINT => Some(Hint),
severity => unreachable!("unrecognized diagnostic severity: {:?}", severity), severity => {
log::error!("unrecognized diagnostic severity: {:?}", severity);
None
}
}); });
if let Some(lang_conf) = language_config { if let Some(lang_conf) = language_config {

Loading…
Cancel
Save