aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-11 07:31:49 +0000
committerBlaž Hrastnik2021-03-11 07:31:49 +0000
commit9dcfe25e4a1868a4936194faf1d753d91d85430a (patch)
treec74f469e83b848c10545819c0fdc511f26457993 /helix-term/src/ui
parentc7ccb432ef174e2eeadafe19dfb8b7c978062dc8 (diff)
Use diagnostic.severity to distinguish between error colors.
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/editor.rs20
1 files changed, 18 insertions, 2 deletions
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(