Add scrollbars to outline panel (#19969)

Part of https://github.com/zed-industries/zed/issues/15324


![image](https://github.com/user-attachments/assets/4f32d585-9bd2-46be-8234-3658a71906ee)

Repeats the approach used in the project panel.

Release Notes:

- Added scrollbars to outline panel

---------

Co-authored-by: Nate Butler <nate@zed.dev>
This commit is contained in:
Kirill Bulatov 2024-10-30 19:09:14 +02:00 committed by GitHub
parent 7bc4cb9868
commit cf7b0c8971
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 613 additions and 291 deletions

View file

@ -414,6 +414,23 @@
// 2. Never show indent guides: // 2. Never show indent guides:
// "never" // "never"
"show": "always" "show": "always"
},
/// Scrollbar-related settings
"scrollbar": {
/// When to show the scrollbar in the project panel.
/// This setting can take four values:
///
/// 1. null (default): Inherit editor settings
/// 2. Show the scrollbar if there's important information or
/// follow the system's configured behavior (default):
/// "auto"
/// 3. Match the system's configured behavior:
/// "system"
/// 4. Always show the scrollbar:
/// "always"
/// 5. Never show the scrollbar:
/// "never"
"show": null
} }
}, },
"collaboration_panel": { "collaboration_panel": {

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,4 @@
use editor::ShowScrollbar;
use gpui::Pixels; use gpui::Pixels;
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -29,6 +30,23 @@ pub struct OutlinePanelSettings {
pub indent_guides: IndentGuidesSettings, pub indent_guides: IndentGuidesSettings,
pub auto_reveal_entries: bool, pub auto_reveal_entries: bool,
pub auto_fold_dirs: bool, pub auto_fold_dirs: bool,
pub scrollbar: ScrollbarSettings,
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
pub struct ScrollbarSettings {
/// When to show the scrollbar in the project panel.
///
/// Default: inherits editor scrollbar settings
pub show: Option<ShowScrollbar>,
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
pub struct ScrollbarSettingsContent {
/// When to show the scrollbar in the project panel.
///
/// Default: inherits editor scrollbar settings
pub show: Option<Option<ShowScrollbar>>,
} }
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] #[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
@ -85,6 +103,8 @@ pub struct OutlinePanelSettingsContent {
pub auto_fold_dirs: Option<bool>, pub auto_fold_dirs: Option<bool>,
/// Settings related to indent guides in the outline panel. /// Settings related to indent guides in the outline panel.
pub indent_guides: Option<IndentGuidesSettingsContent>, pub indent_guides: Option<IndentGuidesSettingsContent>,
/// Scrollbar-related settings
pub scrollbar: Option<ScrollbarSettingsContent>,
} }
impl Settings for OutlinePanelSettings { impl Settings for OutlinePanelSettings {

View file

@ -2271,6 +2271,9 @@ Run the `theme selector: toggle` action in the command palette to see a current
"auto_fold_dirs": true, "auto_fold_dirs": true,
"indent_guides": { "indent_guides": {
"show": "always" "show": "always"
},
"scrollbar": {
"show": null
} }
} }
``` ```