From d24e4fcf0fcf52055838022ea80ae1dc9712a51e Mon Sep 17 00:00:00 2001 From: RoloEdits Date: Tue, 8 Apr 2025 11:58:14 -0700 Subject: [PATCH] feat(config): add `[workspace-]diagnostics` fields to statusline (#13288) --- book/src/editor.md | 4 + helix-term/src/ui/statusline.rs | 162 ++++++++++++++++++++------------ helix-view/src/editor.rs | 4 + 3 files changed, 110 insertions(+), 60 deletions(-) diff --git a/book/src/editor.md b/book/src/editor.md index 1e5c2a507..b79792058 100644 --- a/book/src/editor.md +++ b/book/src/editor.md @@ -104,6 +104,8 @@ separator = "│" mode.normal = "NORMAL" mode.insert = "INSERT" mode.select = "SELECT" +diagnostics = ["warning", "error"] +workspace-diagnostics = ["warning", "error"] ``` The `[editor.statusline]` key takes the following sub-keys: @@ -116,6 +118,8 @@ The `[editor.statusline]` key takes the following sub-keys: | `mode.normal` | The text shown in the `mode` element for normal mode | `"NOR"` | | `mode.insert` | The text shown in the `mode` element for insert mode | `"INS"` | | `mode.select` | The text shown in the `mode` element for select mode | `"SEL"` | +| `diagnostics` | A list of severities which are displayed for the current buffer | `["warning", "error"]` | +| `workspace-diagnostics` | A list of severities which are displayed for the workspace | `["warning", "error"]` | The following statusline elements can be configured: diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index 7437cbd07..adf01bdad 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -226,36 +226,58 @@ fn render_diagnostics(context: &mut RenderContext, write: F) where F: Fn(&mut RenderContext, String, Option