This breaks setting `{"scrollbar": {"show":"never"}}` Release Notes: - N/A
This commit is contained in:
parent
3b37db4140
commit
4d26f83d23
49 changed files with 686 additions and 833 deletions
|
@ -24,12 +24,12 @@ use editor::{
|
|||
use file_icons::FileIcons;
|
||||
use fuzzy::{match_strings, StringMatch, StringMatchCandidate};
|
||||
use gpui::{
|
||||
actions, anchored, deferred, div, impl_actions, uniform_list, Action, AnyElement, AppContext,
|
||||
AssetSource, AsyncWindowContext, ClipboardItem, DismissEvent, Div, ElementId, EventEmitter,
|
||||
FocusHandle, FocusableView, HighlightStyle, InteractiveElement, IntoElement, KeyContext, Model,
|
||||
MouseButton, MouseDownEvent, ParentElement, Pixels, Point, Render, SharedString, Stateful,
|
||||
Styled, Subscription, Task, UniformListScrollHandle, View, ViewContext, VisualContext,
|
||||
WeakView, WindowContext,
|
||||
actions, anchored, deferred, div, impl_actions, px, uniform_list, Action, AnyElement,
|
||||
AppContext, AssetSource, AsyncWindowContext, ClipboardItem, DismissEvent, Div, ElementId,
|
||||
EventEmitter, FocusHandle, FocusableView, HighlightStyle, InteractiveElement, IntoElement,
|
||||
KeyContext, Model, MouseButton, MouseDownEvent, ParentElement, Pixels, Point, Render,
|
||||
SharedString, Stateful, Styled, Subscription, Task, UniformListScrollHandle, View, ViewContext,
|
||||
VisualContext, WeakView, WindowContext,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::{BufferId, BufferSnapshot, OffsetRangeExt, OutlineItem};
|
||||
|
@ -1938,7 +1938,7 @@ impl OutlinePanel {
|
|||
.child(
|
||||
ListItem::new(item_id)
|
||||
.indent_level(depth)
|
||||
.indent_step_size(settings.indent_size)
|
||||
.indent_step_size(px(settings.indent_size))
|
||||
.selected(is_active)
|
||||
.when_some(icon_element, |list_item, icon_element| {
|
||||
list_item.child(h_flex().child(icon_element))
|
||||
|
@ -3801,7 +3801,7 @@ impl Panel for OutlinePanel {
|
|||
DockPosition::Left | DockPosition::Bottom => OutlinePanelDockPosition::Left,
|
||||
DockPosition::Right => OutlinePanelDockPosition::Right,
|
||||
};
|
||||
settings.dock = dock;
|
||||
settings.dock = Some(dock);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use anyhow;
|
||||
use gpui::{px, Pixels};
|
||||
use gpui::Pixels;
|
||||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use settings::{Settings, SettingsSources};
|
||||
|
@ -11,51 +10,66 @@ pub enum OutlinePanelDockPosition {
|
|||
Right,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug, Clone, Copy, PartialEq, JsonSchema)]
|
||||
#[derive(Deserialize, Debug, Clone, Copy, PartialEq)]
|
||||
pub struct OutlinePanelSettings {
|
||||
/// Whether to show the outline panel button in the status bar.
|
||||
pub button: bool,
|
||||
/// Customize default width (in pixels) taken by outline panel
|
||||
pub default_width: Pixels,
|
||||
/// The position of outline panel
|
||||
pub dock: OutlinePanelDockPosition,
|
||||
/// Whether to show file icons in the outline panel.
|
||||
pub file_icons: bool,
|
||||
/// Whether to show folder icons or chevrons for directories in the outline panel.
|
||||
pub folder_icons: bool,
|
||||
/// Whether to show the git status in the outline panel.
|
||||
pub git_status: bool,
|
||||
/// Amount of indentation (in pixels) for nested items.
|
||||
pub indent_size: Pixels,
|
||||
/// Whether to reveal it in the outline panel automatically,
|
||||
/// when a corresponding project entry becomes active.
|
||||
/// Gitignored entries are never auto revealed.
|
||||
pub indent_size: f32,
|
||||
pub auto_reveal_entries: bool,
|
||||
/// Whether to fold directories automatically
|
||||
/// when directory has only one directory inside.
|
||||
pub auto_fold_dirs: bool,
|
||||
}
|
||||
|
||||
impl Default for OutlinePanelSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
button: true,
|
||||
default_width: px(240.),
|
||||
dock: OutlinePanelDockPosition::Left,
|
||||
file_icons: true,
|
||||
folder_icons: true,
|
||||
auto_fold_dirs: true,
|
||||
auto_reveal_entries: true,
|
||||
indent_size: px(20.),
|
||||
git_status: true,
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
|
||||
pub struct OutlinePanelSettingsContent {
|
||||
/// Whether to show the outline panel button in the status bar.
|
||||
///
|
||||
/// Default: true
|
||||
pub button: Option<bool>,
|
||||
/// Customize default width (in pixels) taken by outline panel
|
||||
///
|
||||
/// Default: 240
|
||||
pub default_width: Option<f32>,
|
||||
/// The position of outline panel
|
||||
///
|
||||
/// Default: left
|
||||
pub dock: Option<OutlinePanelDockPosition>,
|
||||
/// Whether to show file icons in the outline panel.
|
||||
///
|
||||
/// Default: true
|
||||
pub file_icons: Option<bool>,
|
||||
/// Whether to show folder icons or chevrons for directories in the outline panel.
|
||||
///
|
||||
/// Default: true
|
||||
pub folder_icons: Option<bool>,
|
||||
/// Whether to show the git status in the outline panel.
|
||||
///
|
||||
/// Default: true
|
||||
pub git_status: Option<bool>,
|
||||
/// Amount of indentation (in pixels) for nested items.
|
||||
///
|
||||
/// Default: 20
|
||||
pub indent_size: Option<f32>,
|
||||
/// Whether to reveal it in the outline panel automatically,
|
||||
/// when a corresponding project entry becomes active.
|
||||
/// Gitignored entries are never auto revealed.
|
||||
///
|
||||
/// Default: true
|
||||
pub auto_reveal_entries: Option<bool>,
|
||||
/// Whether to fold directories automatically
|
||||
/// when directory has only one directory inside.
|
||||
///
|
||||
/// Default: true
|
||||
pub auto_fold_dirs: Option<bool>,
|
||||
}
|
||||
|
||||
impl Settings for OutlinePanelSettings {
|
||||
const KEY: Option<&'static str> = Some("outline_panel");
|
||||
|
||||
type FileContent = Self;
|
||||
type FileContent = OutlinePanelSettingsContent;
|
||||
|
||||
fn load(
|
||||
sources: SettingsSources<Self::FileContent>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue