diff --git a/assets/settings/default.json b/assets/settings/default.json index 11a4b72a10..fc1b1906fc 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -75,17 +75,19 @@ // How many columns a tab should occupy. "tab_size": 4, // Git gutter behavior configuration. - "git_gutter": { - // Which files to show the git gutter on. This setting can take - // three values: - // 1. All files, files not tracked in git will be diffed against - // their contents when the file was last opened in Zed: - // "files_included": "all", - // 2. Only show for files tracked in git: - // "files_included": "only_tracked", - // 3. Disable git gutters entirely: - // "files_included": "none", - "files_included": "all" + "git": { + "git_gutter": { + // Which files to show the git gutter on. This setting can take + // three values: + // 1. All files, files not tracked in git will be diffed against + // their contents when the file was last opened in Zed: + // "files_included": "all", + // 2. Only show for files tracked in git: + // "files_included": "only_tracked", + // 3. Disable git gutters entirely: + // "files_included": "none", + "files_included": "all" + } }, // Settings specific to the terminal "terminal": { diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index 627eaf719e..609ae89625 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -1744,7 +1744,7 @@ impl Server { Ok(()) } - async fn get_private_user_info( + async fn get_private_user_info( self: Arc, request: TypedEnvelope, response: Response, diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index e04ff2b516..b914282e01 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -665,9 +665,9 @@ impl LocalWorktree { let files_included = cx .global::() - .editor_overrides + .git .git_gutter - .unwrap_or_default() + .expect("This should be Some by setting setup") .files_included; cx.spawn(|this, mut cx| async move { diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index 3f4a764c79..9de4335ec8 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -32,6 +32,7 @@ pub struct Settings { pub default_dock_anchor: DockAnchor, pub editor_defaults: EditorSettings, pub editor_overrides: EditorSettings, + pub git: GitSettings, pub terminal_defaults: TerminalSettings, pub terminal_overrides: TerminalSettings, pub language_defaults: HashMap, EditorSettings>, @@ -52,20 +53,13 @@ impl FeatureFlags { } } -#[derive(Clone, Debug, Default, Deserialize, JsonSchema)] -pub struct EditorSettings { - pub tab_size: Option, - pub hard_tabs: Option, - pub soft_wrap: Option, - pub preferred_line_length: Option, - pub format_on_save: Option, - pub formatter: Option, - pub enable_language_server: Option, - pub git_gutter: Option, +#[derive(Copy, Clone, Debug, Default, Deserialize, JsonSchema)] +pub struct GitSettings { + pub git_gutter: Option, } #[derive(Clone, Copy, Debug, Default, Deserialize, JsonSchema)] -pub struct GitGutterConfig { +pub struct GitGutterSettings { pub files_included: GitFilesIncluded, pub debounce_delay_millis: Option, } @@ -79,6 +73,17 @@ pub enum GitFilesIncluded { None, } +#[derive(Clone, Debug, Default, Deserialize, JsonSchema)] +pub struct EditorSettings { + pub tab_size: Option, + pub hard_tabs: Option, + pub soft_wrap: Option, + pub preferred_line_length: Option, + pub format_on_save: Option, + pub formatter: Option, + pub enable_language_server: Option, +} + #[derive(Copy, Clone, Debug, Deserialize, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] pub enum SoftWrap { @@ -212,6 +217,8 @@ pub struct SettingsFileContent { #[serde(default)] pub terminal: TerminalSettings, #[serde(default)] + pub git: Option, + #[serde(default)] #[serde(alias = "language_overrides")] pub languages: HashMap, EditorSettings>, #[serde(default)] @@ -266,9 +273,9 @@ impl Settings { format_on_save: required(defaults.editor.format_on_save), formatter: required(defaults.editor.formatter), enable_language_server: required(defaults.editor.enable_language_server), - git_gutter: defaults.editor.git_gutter, }, editor_overrides: Default::default(), + git: defaults.git.unwrap(), terminal_defaults: Default::default(), terminal_overrides: Default::default(), language_defaults: defaults.languages, @@ -395,11 +402,11 @@ impl Settings { format_on_save: Some(FormatOnSave::On), formatter: Some(Formatter::LanguageServer), enable_language_server: Some(true), - git_gutter: Default::default(), }, editor_overrides: Default::default(), terminal_defaults: Default::default(), terminal_overrides: Default::default(), + git: Default::default(), language_defaults: Default::default(), language_overrides: Default::default(), lsp: Default::default(), diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 921fb2de20..fc1f6432a1 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -736,9 +736,9 @@ impl ItemHandle for ViewHandle { let debounce_delay = cx .global::() - .editor_overrides + .git .git_gutter - .unwrap_or_default() + .expect("This should be Some by setting setup") .debounce_delay_millis; let item = item.clone();