1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
use lsp_types::DiagnosticSeverity;
use crate::DiagnosticLevel;


impl DiagnosticLevel {
    /// Convert to lsp [`DiagnosticSeverity`]
    pub fn into_severity(self) -> Option<DiagnosticSeverity> {
        match self {
            Self::None => None,
            Self::Error => Some(DiagnosticSeverity::ERROR),
            Self::Warning => Some(DiagnosticSeverity::WARNING),
            Self::Information => Some(DiagnosticSeverity::INFORMATION),
            Self::Hint => Some(DiagnosticSeverity::HINT),
        }
    }
}