diff options
author | Blaž Hrastnik | 2021-03-11 07:31:49 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-03-11 07:31:49 +0000 |
commit | 9dcfe25e4a1868a4936194faf1d753d91d85430a (patch) | |
tree | c74f469e83b848c10545819c0fdc511f26457993 /helix-term/src/application.rs | |
parent | c7ccb432ef174e2eeadafe19dfb8b7c978062dc8 (diff) |
Use diagnostic.severity to distinguish between error colors.
Diffstat (limited to 'helix-term/src/application.rs')
-rw-r--r-- | helix-term/src/application.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 583d8fc8..24b5317b 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -139,15 +139,25 @@ impl Application { .diagnostics .into_iter() .map(|diagnostic| { - use helix_lsp::util::lsp_pos_to_pos; + use helix_core::diagnostic::Severity::*; + use helix_core::{diagnostic::Severity, Diagnostic}; + use helix_lsp::{lsp, util::lsp_pos_to_pos}; + use lsp::DiagnosticSeverity; let start = lsp_pos_to_pos(doc, diagnostic.range.start); let end = lsp_pos_to_pos(doc, diagnostic.range.end); - helix_core::Diagnostic { + Diagnostic { range: (start, end), line: diagnostic.range.start.line as usize, message: diagnostic.message, - // severity + severity: diagnostic.severity.map( + |severity| match severity { + DiagnosticSeverity::Error => Error, + DiagnosticSeverity::Warning => Warning, + DiagnosticSeverity::Information => Info, + DiagnosticSeverity::Hint => Hint, + }, + ), // code // source } |