summaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/application.rs16
-rw-r--r--helix-term/src/ui/editor.rs20
2 files changed, 31 insertions, 5 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
}
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 7a5e4aa5..ae48950f 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -283,10 +283,26 @@ impl EditorView {
let style: Style = theme.get("ui.linenr");
let warning: Style = theme.get("warning");
+ let error: Style = theme.get("error");
+ let info: Style = theme.get("info");
+ let hint: Style = theme.get("hint");
+
let last_line = view.last_line();
for (i, line) in (view.first_line..last_line).enumerate() {
- if view.doc.diagnostics.iter().any(|d| d.line == line) {
- surface.set_stringn(viewport.x - OFFSET, viewport.y + i as u16, "●", 1, warning);
+ use helix_core::diagnostic::Severity;
+ if let Some(diagnostic) = view.doc.diagnostics.iter().find(|d| d.line == line) {
+ surface.set_stringn(
+ viewport.x - OFFSET,
+ viewport.y + i as u16,
+ "●",
+ 1,
+ match diagnostic.severity {
+ Some(Severity::Error) => error,
+ Some(Severity::Warning) | None => warning,
+ Some(Severity::Info) => info,
+ Some(Severity::Hint) => hint,
+ },
+ );
}
surface.set_stringn(