Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

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

Stanislav Alekseev44c479c50c58
diff --git a/assets/settings/default.json b/assets/settings/default.json
index 557aebd4570..dc86eaa8f13 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 ac32aaadd1e..26ac14acdbe 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 a30fc1b2cc2..0faec8f398e 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 ebb6ae50595..345d4912440 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 e3c84fee2e0..fab59df60d7 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
{