@@ -1,4 +1,5 @@
1use helix_core::{coords_at_pos, encoding, Position};
1use helix_core::{coords_at_pos, encoding, Position};
2+use helix_lsp::lsp::DiagnosticSeverity;
2use helix_view::{
3use helix_view::{
3 document::{Mode, SCRATCH_BUFFER_NAME},
4 document::{Mode, SCRATCH_BUFFER_NAME},
4 graphics::Rect,
5 graphics::Rect,
@@ -141,6 +142,7 @@ where
141 helix_view::editor::StatusLineElement::FileLineEnding => render_file_line_ending,
142 helix_view::editor::StatusLineElement::FileLineEnding => render_file_line_ending,
142 helix_view::editor::StatusLineElement::FileType => render_file_type,
143 helix_view::editor::StatusLineElement::FileType => render_file_type,
143 helix_view::editor::StatusLineElement::Diagnostics => render_diagnostics,
144 helix_view::editor::StatusLineElement::Diagnostics => render_diagnostics,
145+ helix_view::editor::StatusLineElement::WorkspaceDiagnostics => render_workspace_diagnostics,
144 helix_view::editor::StatusLineElement::Selections => render_selections,
146 helix_view::editor::StatusLineElement::Selections => render_selections,
145 helix_view::editor::StatusLineElement::PrimarySelectionLength => {
147 helix_view::editor::StatusLineElement::PrimarySelectionLength => {
146 render_primary_selection_length
148 render_primary_selection_length
@@ -245,6 +247,48 @@ where
250+fn render_workspace_diagnostics<F>(context: &mut RenderContext, write: F)
252+ F: Fn(&mut RenderContext, String, Option<Style>) + Copy,
254+ let (warnings, errors) =
260+ .fold((0, 0), |mut counts, diag| {
261+ match diag.severity {
262+ Some(DiagnosticSeverity::WARNING) => counts.0 += 1,
263+ Some(DiagnosticSeverity::ERROR) | None => counts.1 += 1,
269+ if warnings > 0 || errors > 0 {
270+ write(context, format!(" {} ", "W"), None);
277+ Some(context.editor.theme.get("warning")),
279+ write(context, format!(" {} ", warnings), None);
286+ Some(context.editor.theme.get("error")),
288+ write(context, format!(" {} ", errors), None);
248fn render_selections<F>(context: &mut RenderContext, write: F)
292fn render_selections<F>(context: &mut RenderContext, write: F)
250 F: Fn(&mut RenderContext, String, Option<Style>) + Copy,
294 F: Fn(&mut RenderContext, String, Option<Style>) + Copy,