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
|
@ -20,7 +20,6 @@ use worktree::{PathChange, UpdatedEntriesSet, Worktree, WorktreeId};
|
|||
use crate::worktree_store::{WorktreeStore, WorktreeStoreEvent};
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonSchema)]
|
||||
#[serde(default)]
|
||||
pub struct ProjectSettings {
|
||||
/// Configuration for language servers.
|
||||
///
|
||||
|
@ -42,6 +41,7 @@ pub struct ProjectSettings {
|
|||
pub load_direnv: DirenvSettings,
|
||||
|
||||
/// Configuration for session-related features
|
||||
#[serde(default)]
|
||||
pub session: SessionSettings,
|
||||
}
|
||||
|
||||
|
@ -59,31 +59,36 @@ pub enum DirenvSettings {
|
|||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema)]
|
||||
#[serde(default)]
|
||||
pub struct GitSettings {
|
||||
/// Whether or not to show the git gutter.
|
||||
///
|
||||
/// Default: tracked_files
|
||||
pub git_gutter: GitGutterSetting,
|
||||
pub git_gutter: Option<GitGutterSetting>,
|
||||
pub gutter_debounce: Option<u64>,
|
||||
/// Whether or not to show git blame data inline in
|
||||
/// the currently focused line.
|
||||
///
|
||||
/// Default: on
|
||||
pub inline_blame: InlineBlameSettings,
|
||||
pub inline_blame: Option<InlineBlameSettings>,
|
||||
}
|
||||
|
||||
impl GitSettings {
|
||||
pub fn inline_blame_enabled(&self) -> bool {
|
||||
#[allow(unknown_lints, clippy::manual_unwrap_or_default)]
|
||||
self.inline_blame.enabled
|
||||
match self.inline_blame {
|
||||
Some(InlineBlameSettings { enabled, .. }) => enabled,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn inline_blame_delay(&self) -> Option<Duration> {
|
||||
self.inline_blame
|
||||
.delay_ms
|
||||
.gt(&0)
|
||||
.then(|| Duration::from_millis(self.inline_blame.delay_ms))
|
||||
match self.inline_blame {
|
||||
Some(InlineBlameSettings {
|
||||
delay_ms: Some(delay_ms),
|
||||
..
|
||||
}) if delay_ms > 0 => Some(Duration::from_millis(delay_ms)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,34 +102,28 @@ pub enum GitGutterSetting {
|
|||
Hide,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, JsonSchema)]
|
||||
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, JsonSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[serde(default)]
|
||||
pub struct InlineBlameSettings {
|
||||
/// Whether or not to show git blame data inline in
|
||||
/// the currently focused line.
|
||||
///
|
||||
/// Default: true
|
||||
#[serde(default = "true_value")]
|
||||
pub enabled: bool,
|
||||
/// Whether to only show the inline blame information
|
||||
/// after a delay once the cursor stops moving.
|
||||
///
|
||||
/// Default: 0
|
||||
pub delay_ms: u64,
|
||||
pub delay_ms: Option<u64>,
|
||||
/// The minimum column number to show the inline blame information at
|
||||
///
|
||||
/// Default: 0
|
||||
pub min_column: u32,
|
||||
pub min_column: Option<u32>,
|
||||
}
|
||||
|
||||
impl Default for InlineBlameSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
enabled: true,
|
||||
delay_ms: 0,
|
||||
min_column: 0,
|
||||
}
|
||||
}
|
||||
const fn true_value() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue