project panel: Add setting to disable auto opening project panel (#34752)
Release Notes: - Add `project_panel.starts_open` to control opening project panel in new projects.
This commit is contained in:
parent
9edc01d9a5
commit
0169bddb59
4 changed files with 13 additions and 1 deletions
|
@ -596,6 +596,8 @@
|
||||||
// when a corresponding project entry becomes active.
|
// when a corresponding project entry becomes active.
|
||||||
// Gitignored entries are never auto revealed.
|
// Gitignored entries are never auto revealed.
|
||||||
"auto_reveal_entries": true,
|
"auto_reveal_entries": true,
|
||||||
|
// Whether the project panel should open on startup.
|
||||||
|
"starts_open": true,
|
||||||
// Whether to fold directories automatically and show compact folders
|
// Whether to fold directories automatically and show compact folders
|
||||||
// (e.g. "a/b/c" ) when a directory has only one subdirectory inside.
|
// (e.g. "a/b/c" ) when a directory has only one subdirectory inside.
|
||||||
"auto_fold_dirs": true,
|
"auto_fold_dirs": true,
|
||||||
|
|
|
@ -5625,6 +5625,10 @@ impl Panel for ProjectPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn starts_open(&self, _: &Window, cx: &App) -> bool {
|
fn starts_open(&self, _: &Window, cx: &App) -> bool {
|
||||||
|
if !ProjectPanelSettings::get_global(cx).starts_open {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let project = &self.project.read(cx);
|
let project = &self.project.read(cx);
|
||||||
project.visible_worktrees(cx).any(|tree| {
|
project.visible_worktrees(cx).any(|tree| {
|
||||||
tree.read(cx)
|
tree.read(cx)
|
||||||
|
|
|
@ -43,6 +43,7 @@ pub struct ProjectPanelSettings {
|
||||||
pub sticky_scroll: bool,
|
pub sticky_scroll: bool,
|
||||||
pub auto_reveal_entries: bool,
|
pub auto_reveal_entries: bool,
|
||||||
pub auto_fold_dirs: bool,
|
pub auto_fold_dirs: bool,
|
||||||
|
pub starts_open: bool,
|
||||||
pub scrollbar: ScrollbarSettings,
|
pub scrollbar: ScrollbarSettings,
|
||||||
pub show_diagnostics: ShowDiagnostics,
|
pub show_diagnostics: ShowDiagnostics,
|
||||||
pub hide_root: bool,
|
pub hide_root: bool,
|
||||||
|
@ -139,6 +140,10 @@ pub struct ProjectPanelSettingsContent {
|
||||||
///
|
///
|
||||||
/// Default: true
|
/// Default: true
|
||||||
pub auto_fold_dirs: Option<bool>,
|
pub auto_fold_dirs: Option<bool>,
|
||||||
|
/// Whether the project panel should open on startup.
|
||||||
|
///
|
||||||
|
/// Default: true
|
||||||
|
pub starts_open: Option<bool>,
|
||||||
/// Scrollbar-related settings
|
/// Scrollbar-related settings
|
||||||
pub scrollbar: Option<ScrollbarSettingsContent>,
|
pub scrollbar: Option<ScrollbarSettingsContent>,
|
||||||
/// Which files containing diagnostic errors/warnings to mark in the project panel.
|
/// Which files containing diagnostic errors/warnings to mark in the project panel.
|
||||||
|
|
|
@ -3213,7 +3213,8 @@ Run the `theme selector: toggle` action in the command palette to see a current
|
||||||
"indent_guides": {
|
"indent_guides": {
|
||||||
"show": "always"
|
"show": "always"
|
||||||
},
|
},
|
||||||
"hide_root": false
|
"hide_root": false,
|
||||||
|
"starts_open": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue