Fix Auto folded dirs performance issues (#8556)
Fixed auto folded dirs which caused significant performance issues #8476 (#7674) Moved from iterating over snapshot entries to use `child_entries` function from `worktree.rs` by making it public @maxbrunsfeld Release Notes: - Fixed a bug where project panel settings changes would not be applied immediately. - Added a `project_panel.auto_fold_dirs` setting which collapses the nesting in the project panel when there is a chain of folders containing a single folder. <img width="288" alt="Screenshot 2024-04-12 at 11 10 58 AM" src="https://github.com/zed-industries/zed/assets/2280405/efd61e75-026c-464d-ba4d-90db5f68bad3"> --------- Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
28586060a1
commit
8bca9cea26
4 changed files with 324 additions and 13 deletions
|
@ -4,14 +4,14 @@ use schemars::JsonSchema;
|
|||
use serde_derive::{Deserialize, Serialize};
|
||||
use settings::{Settings, SettingsSources};
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, Copy, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ProjectPanelDockPosition {
|
||||
Left,
|
||||
Right,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[derive(Deserialize, Debug, Clone, Copy, PartialEq)]
|
||||
pub struct ProjectPanelSettings {
|
||||
pub default_width: Pixels,
|
||||
pub dock: ProjectPanelDockPosition,
|
||||
|
@ -20,6 +20,7 @@ pub struct ProjectPanelSettings {
|
|||
pub git_status: bool,
|
||||
pub indent_size: f32,
|
||||
pub auto_reveal_entries: bool,
|
||||
pub auto_fold_dirs: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
|
||||
|
@ -54,6 +55,11 @@ pub struct ProjectPanelSettingsContent {
|
|||
///
|
||||
/// Default: true
|
||||
pub auto_reveal_entries: Option<bool>,
|
||||
/// Whether to fold directories automatically
|
||||
/// when directory has only one directory inside.
|
||||
///
|
||||
/// Default: false
|
||||
pub auto_fold_dirs: Option<bool>,
|
||||
}
|
||||
|
||||
impl Settings for ProjectPanelSettings {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue