(self, document: &LspDocument, command: &str)
| 599 | |
| 600 | impl LspDiagnostic { |
| 601 | fn into_code_diagnostic(self, document: &LspDocument, command: &str) -> CodeDiagnostic { |
| 602 | CodeDiagnostic { |
| 603 | language: document.language.clone(), |
| 604 | source: self.source.unwrap_or_else(|| command.to_string()), |
| 605 | file: document.relative_path.clone(), |
| 606 | line_start: self.range.start.line + 1, |
| 607 | line_end: self.range.end.line + 1, |
| 608 | character_start: Some(self.range.start.character), |
| 609 | character_end: Some(self.range.end.character), |
| 610 | severity: match self.severity { |
| 611 | Some(1) => DiagnosticSeverity::Error, |
| 612 | Some(2) => DiagnosticSeverity::Warning, |
| 613 | Some(4) => DiagnosticSeverity::Hint, |
| 614 | _ => DiagnosticSeverity::Information, |
| 615 | }, |
| 616 | code: self.code.and_then(code_to_string), |
| 617 | message: self.message, |
| 618 | enclosing_node: None, |
| 619 | updated_at: now_unix(), |
| 620 | } |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | fn now_unix() -> i64 { |
no test coverage detected