From 92ae31925f9e8d24e518f1cb99052052c0c62dfe Mon Sep 17 00:00:00 2001 From: David Vogt Date: Tue, 26 Sep 2023 15:17:45 +0200 Subject: [PATCH] feat: tree sitter path This adds a "tree-sitter-path" element to the possible status lines, which is useful for large code bases where you cannot see the beginning of the current function/class/type etc. Suggested config: ``` [editor.statusline] center = ["tree-sitter-path"] ``` --- helix-term/src/ui/statusline.rs | 50 +++++++++++++++++++++++++++++++++ helix-view/src/editor.rs | 3 ++ 2 files changed, 53 insertions(+) diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index 7437cbd07..6dd2b0433 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -158,6 +158,7 @@ where } helix_view::editor::StatusLineElement::Position => render_position, helix_view::editor::StatusLineElement::PositionPercentage => render_position_percentage, + helix_view::editor::StatusLineElement::TreeSitterPath => render_tree_sitter_path, helix_view::editor::StatusLineElement::TotalLineNumbers => render_total_line_numbers, helix_view::editor::StatusLineElement::Separator => render_separator, helix_view::editor::StatusLineElement::Spacer => render_spacer, @@ -381,6 +382,55 @@ where } } +fn render_tree_sitter_path(context: &mut RenderContext, write: F) +where + F: Fn(&mut RenderContext, String, Option