mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 01:16:18 +04:00
lsp: Gracefully ignore invalid diagnostic severity (#11569)
This commit is contained in:
parent
620dfceb84
commit
af7a1fd20c
@ -1920,12 +1920,15 @@ pub fn lsp_diagnostic_to_diagnostic(
|
||||
return None;
|
||||
};
|
||||
|
||||
let severity = diagnostic.severity.map(|severity| match severity {
|
||||
lsp::DiagnosticSeverity::ERROR => Error,
|
||||
lsp::DiagnosticSeverity::WARNING => Warning,
|
||||
lsp::DiagnosticSeverity::INFORMATION => Info,
|
||||
lsp::DiagnosticSeverity::HINT => Hint,
|
||||
severity => unreachable!("unrecognized diagnostic severity: {:?}", severity),
|
||||
let severity = diagnostic.severity.and_then(|severity| match severity {
|
||||
lsp::DiagnosticSeverity::ERROR => Some(Error),
|
||||
lsp::DiagnosticSeverity::WARNING => Some(Warning),
|
||||
lsp::DiagnosticSeverity::INFORMATION => Some(Info),
|
||||
lsp::DiagnosticSeverity::HINT => Some(Hint),
|
||||
severity => {
|
||||
log::error!("unrecognized diagnostic severity: {:?}", severity);
|
||||
None
|
||||
}
|
||||
});
|
||||
|
||||
if let Some(lang_conf) = language_config {
|
||||
|
Loading…
Reference in New Issue
Block a user