From eaf8d6d30da5014a3c475c4187b9dccfe621afd5 Mon Sep 17 00:00:00 2001 From: JJ Date: Tue, 31 Oct 2023 18:00:19 -0700 Subject: Add rainbow tree-sitter highlights ref: https://github.com/helix-editor/helix/issues/695 ref: https://github.com/helix-editor/helix/pull/2857 Co-authored-by: Michael Davis --- helix-view/src/editor.rs | 6 ++- helix-view/src/theme.rs | 113 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 113 insertions(+), 6 deletions(-) (limited to 'helix-view/src') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index f285aa99..fbfed656 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -308,6 +308,8 @@ pub struct Config { pub explorer: ExplorerConfig, /// Whether to color modes with different colors. Defaults to `false`. pub color_modes: bool, + /// Whether to render rainbow highlights. Defaults to `false`. + pub rainbow_brackets: bool, pub soft_wrap: SoftWrap, /// Workspace specific lsp ceiling dirs pub workspace_lsp_roots: Vec, @@ -863,6 +865,7 @@ impl Default for Config { indent_guides: IndentGuidesConfig::default(), explorer: ExplorerConfig::default(), color_modes: false, + rainbow_brackets: false, soft_wrap: SoftWrap { enable: Some(false), ..SoftWrap::default() @@ -1203,8 +1206,7 @@ impl Editor { return; } - let scopes = theme.scopes(); - self.syn_loader.set_scopes(scopes.to_vec()); + self.syn_loader.set_scopes(theme.scopes().to_vec()); match preview { ThemeAction::Preview => { diff --git a/helix-view/src/theme.rs b/helix-view/src/theme.rs index 4acc5664..16da247f 100644 --- a/helix-view/src/theme.rs +++ b/helix-view/src/theme.rs @@ -216,17 +216,19 @@ pub struct Theme { // tree-sitter highlight styles are stored in a Vec to optimize lookups scopes: Vec, highlights: Vec