Indent guides (#11503)

Builds on top of existing work from #2249, but here's a showcase:


https://github.com/zed-industries/zed/assets/53836821/4b346965-6654-496c-b379-75425d9b493f

TODO:
- [x] handle line wrapping
- [x] implement handling in multibuffer (crashes currently)
- [x] add configuration option
- [x] new theme properties? What colors to use?
- [x] Possibly support indents with different colors or background
colors
- [x] investigate edge cases (e.g. indent guides and folds continue on
empty lines even if the next indent is different)
- [x] add more tests (also test `find_active_indent_index`)
- [x] docs (will do in a follow up PR)
- [x] benchmark performance impact

Release Notes:

- Added indent guides
([#5373](https://github.com/zed-industries/zed/issues/5373))

---------

Co-authored-by: Nate Butler <1714999+iamnbutler@users.noreply.github.com>
Co-authored-by: Remco <djsmits12@gmail.com>
This commit is contained in:
Bennet Bo Fenner
2024-05-23 15:50:59 +02:00
committed by GitHub
co-authored by Nate Butler Remco
parent 3eb0418bda
commit feea607bac
27 changed files with 1705 additions and 65 deletions
+10 -3
View File
@@ -12,8 +12,9 @@ use refineable::Refineable;
use util::ResultExt;
use crate::{
try_parse_color, Appearance, AppearanceContent, PlayerColors, StatusColors, SyntaxTheme,
SystemColors, Theme, ThemeColors, ThemeContent, ThemeFamily, ThemeFamilyContent, ThemeStyles,
try_parse_color, AccentColors, Appearance, AppearanceContent, PlayerColors, StatusColors,
SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeContent, ThemeFamily, ThemeFamilyContent,
ThemeStyles,
};
#[derive(Debug, Clone)]
@@ -118,6 +119,12 @@ impl ThemeRegistry {
};
player_colors.merge(&user_theme.style.players);
let mut accent_colors = match user_theme.appearance {
AppearanceContent::Light => AccentColors::light(),
AppearanceContent::Dark => AccentColors::dark(),
};
accent_colors.merge(&user_theme.style.accents);
let syntax_highlights = user_theme
.style
.syntax
@@ -156,11 +163,11 @@ impl ThemeRegistry {
styles: ThemeStyles {
system: SystemColors::default(),
window_background_appearance,
accents: accent_colors,
colors: theme_colors,
status: status_colors,
player: player_colors,
syntax: syntax_theme,
accents: Vec::new(),
},
}
}));