diff --git a/assets/settings/default.json b/assets/settings/default.json index 557aebd4570c49c469447724cdaa22234cc519f0..dc86eaa8f135e6c3d7431669b3159eca5c92013e 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -241,6 +241,8 @@ "enabled": true, /// The width of the indent guides in pixels, between 1 and 10. "line_width": 1, + /// The width of the active indent guide in pixels, between 1 and 10. + "active_line_width": 1, /// Determines how indent guides are colored. /// This setting can take the following three values: /// diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index ac32aaadd1e73808c13e9d3227b1f3c66cd78859..26ac14acdbe0430a2ccdd4a1734ba362ef1f84ba 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -11808,6 +11808,7 @@ fn indent_guide(buffer_id: BufferId, start_row: u32, end_row: u32, depth: u32) - settings: IndentGuideSettings { enabled: true, line_width: 1, + active_line_width: 1, ..Default::default() }, } diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index a30fc1b2cc2950964ba94992a7dc38ce2d1184f1..0faec8f398e87267028b3dff2ef4978102480aab 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -2791,7 +2791,12 @@ impl EditorElement { )), }; - let requested_line_width = settings.line_width.clamp(1, 10); + let requested_line_width = if indent_guide.active { + settings.active_line_width + } else { + settings.line_width + } + .clamp(1, 10); let mut line_indicator_width = 0.; if let Some(color) = line_color { cx.paint_quad(fill( diff --git a/crates/language/src/language_settings.rs b/crates/language/src/language_settings.rs index ebb6ae50595ddcaaba38d1dadc6fad5d40322a3f..345d4912440ee1a8c477f6e854b987ed9055ba35 100644 --- a/crates/language/src/language_settings.rs +++ b/crates/language/src/language_settings.rs @@ -450,6 +450,11 @@ pub struct IndentGuideSettings { /// Default: 1 #[serde(default = "line_width")] pub line_width: u32, + /// The width of the active indent guide in pixels, between 1 and 10. + /// + /// Default: 1 + #[serde(default = "active_line_width")] + pub active_line_width: u32, /// Determines how indent guides are colored. /// /// Default: Fixed @@ -466,6 +471,10 @@ fn line_width() -> u32 { 1 } +fn active_line_width() -> u32 { + line_width() +} + /// Determines how indent guides are colored. #[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "snake_case")] diff --git a/docs/src/configuring-zed.md b/docs/src/configuring-zed.md index e3c84fee2e0983bb9bf11f201c9522dd66c209da..fab59df60d7f6f6370c29ae048dfccbb68b1b739 100644 --- a/docs/src/configuring-zed.md +++ b/docs/src/configuring-zed.md @@ -725,6 +725,7 @@ To interpret all `.c` files as C++, files called `MyLockFile` as TOML and files "indent_guides": { "enabled": true, "line_width": 1, + "active_line_width": 1, "coloring": "fixed", "background_coloring": "disabled" } @@ -758,7 +759,7 @@ To interpret all `.c` files as C++, files called `MyLockFile` as TOML and files ``` 3. Enable indent aware coloring ("rainbow indentation"). -The colors that are used for different indentation levels are defined in the theme (theme key: `accents`). They can be customized by using theme overrides. + The colors that are used for different indentation levels are defined in the theme (theme key: `accents`). They can be customized by using theme overrides. ```json { @@ -770,7 +771,7 @@ The colors that are used for different indentation levels are defined in the the ``` 4. Enable indent aware background coloring ("rainbow indentation"). -The colors that are used for different indentation levels are defined in the theme (theme key: `accents`). They can be customized by using theme overrides. + The colors that are used for different indentation levels are defined in the theme (theme key: `accents`). They can be customized by using theme overrides. ```json {