Add a setting to increase the thickness of the active indent guide (#13210)

Stanislav Alekseev created

Resolves #12312.

Release Notes:

- Added an option to configure the line width of the active indent guide
[#12312](https://github.com/zed-industries/zed/issues/12312)

Change summary

assets/settings/default.json             | 2 ++
crates/editor/src/editor_tests.rs        | 1 +
crates/editor/src/element.rs             | 7 ++++++-
crates/language/src/language_settings.rs | 9 +++++++++
docs/src/configuring-zed.md              | 5 +++--
5 files changed, 21 insertions(+), 3 deletions(-)

Detailed changes

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:
     ///

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()
         },
     }

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(

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")]

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
 {