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:
co-authored by
Nate Butler
Remco
parent
3eb0418bda
commit
feea607bac
@@ -75,6 +75,9 @@ pub struct ThemeStyleContent {
|
||||
#[serde(default, rename = "background.appearance")]
|
||||
pub window_background_appearance: Option<WindowBackgroundContent>,
|
||||
|
||||
#[serde(default)]
|
||||
pub accents: Vec<AccentContent>,
|
||||
|
||||
#[serde(flatten, default)]
|
||||
pub colors: ThemeColorsContent,
|
||||
|
||||
@@ -381,6 +384,12 @@ pub struct ThemeColorsContent {
|
||||
#[serde(rename = "editor.active_wrap_guide")]
|
||||
pub editor_active_wrap_guide: Option<String>,
|
||||
|
||||
#[serde(rename = "editor.indent_guide")]
|
||||
pub editor_indent_guide: Option<String>,
|
||||
|
||||
#[serde(rename = "editor.indent_guide_active")]
|
||||
pub editor_indent_guide_active: Option<String>,
|
||||
|
||||
/// Read-access of a symbol, like reading a variable.
|
||||
///
|
||||
/// A document highlight is a range inside a text document which deserves
|
||||
@@ -747,6 +756,14 @@ impl ThemeColorsContent {
|
||||
.editor_active_wrap_guide
|
||||
.as_ref()
|
||||
.and_then(|color| try_parse_color(color).ok()),
|
||||
editor_indent_guide: self
|
||||
.editor_indent_guide
|
||||
.as_ref()
|
||||
.and_then(|color| try_parse_color(color).ok()),
|
||||
editor_indent_guide_active: self
|
||||
.editor_indent_guide_active
|
||||
.as_ref()
|
||||
.and_then(|color| try_parse_color(color).ok()),
|
||||
editor_document_highlight_read_background: self
|
||||
.editor_document_highlight_read_background
|
||||
.as_ref()
|
||||
@@ -1196,6 +1213,9 @@ impl StatusColorsContent {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
|
||||
pub struct AccentContent(pub Option<String>);
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
|
||||
pub struct PlayerColorContent {
|
||||
pub cursor: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user