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

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)
This commit is contained in:
Stanislav Alekseev 2024-06-21 11:53:46 +03:00 committed by GitHub
parent c8709978a1
commit 44c479c50c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 21 additions and 3 deletions

View file

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

View file

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

View file

@ -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(

View file

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

View file

@ -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
{