diff --git a/book/src/configuration.md b/book/src/configuration.md index 9f3fe2fa95bd..9e9c04fa1cab 100644 --- a/book/src/configuration.md +++ b/book/src/configuration.md @@ -102,6 +102,7 @@ The following statusline elements can be configured: | `total-line-numbers` | The total line numbers of the opened file | | `file-type` | The type of the opened file | | `diagnostics` | The number of warnings and/or errors | +| `workspace-diagnostics` | The number of warnings and/or errors on workspace | | `selections` | The number of active selections | | `position` | The cursor position | | `position-percentage` | The cursor position as a percentage of the total number of lines | diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index b0e8ec5d2546..b79846fa2277 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -1,4 +1,5 @@ use helix_core::{coords_at_pos, encoding, Position}; +use helix_lsp::lsp::DiagnosticSeverity; use helix_view::{ document::{Mode, SCRATCH_BUFFER_NAME}, graphics::Rect, @@ -141,6 +142,7 @@ where helix_view::editor::StatusLineElement::FileLineEnding => render_file_line_ending, helix_view::editor::StatusLineElement::FileType => render_file_type, helix_view::editor::StatusLineElement::Diagnostics => render_diagnostics, + helix_view::editor::StatusLineElement::WorkspaceDiagnostics => render_workspace_diagnostics, helix_view::editor::StatusLineElement::Selections => render_selections, helix_view::editor::StatusLineElement::Position => render_position, helix_view::editor::StatusLineElement::PositionPercentage => render_position_percentage, @@ -242,6 +244,48 @@ where } } +fn render_workspace_diagnostics(context: &mut RenderContext, write: F) +where + F: Fn(&mut RenderContext, String, Option