mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-23 18:32:17 +00:00
Move git gutter settings out of editor settings
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
parent
8f4b3c3493
commit
a5c2f22bf7
5 changed files with 38 additions and 29 deletions
|
@ -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": {
|
||||
|
|
|
@ -1744,7 +1744,7 @@ impl Server {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
async fn get_private_user_info(
|
||||
async fn get_private_user_info(
|
||||
self: Arc<Self>,
|
||||
request: TypedEnvelope<proto::GetPrivateUserInfo>,
|
||||
response: Response<proto::GetPrivateUserInfo>,
|
||||
|
|
|
@ -665,9 +665,9 @@ impl LocalWorktree {
|
|||
|
||||
let files_included = cx
|
||||
.global::<Settings>()
|
||||
.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 {
|
||||
|
|
|
@ -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<Arc<str>, EditorSettings>,
|
||||
|
@ -52,20 +53,13 @@ impl FeatureFlags {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, JsonSchema)]
|
||||
pub struct EditorSettings {
|
||||
pub tab_size: Option<NonZeroU32>,
|
||||
pub hard_tabs: Option<bool>,
|
||||
pub soft_wrap: Option<SoftWrap>,
|
||||
pub preferred_line_length: Option<u32>,
|
||||
pub format_on_save: Option<FormatOnSave>,
|
||||
pub formatter: Option<Formatter>,
|
||||
pub enable_language_server: Option<bool>,
|
||||
pub git_gutter: Option<GitGutterConfig>,
|
||||
#[derive(Copy, Clone, Debug, Default, Deserialize, JsonSchema)]
|
||||
pub struct GitSettings {
|
||||
pub git_gutter: Option<GitGutterSettings>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Deserialize, JsonSchema)]
|
||||
pub struct GitGutterConfig {
|
||||
pub struct GitGutterSettings {
|
||||
pub files_included: GitFilesIncluded,
|
||||
pub debounce_delay_millis: Option<u64>,
|
||||
}
|
||||
|
@ -79,6 +73,17 @@ pub enum GitFilesIncluded {
|
|||
None,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, JsonSchema)]
|
||||
pub struct EditorSettings {
|
||||
pub tab_size: Option<NonZeroU32>,
|
||||
pub hard_tabs: Option<bool>,
|
||||
pub soft_wrap: Option<SoftWrap>,
|
||||
pub preferred_line_length: Option<u32>,
|
||||
pub format_on_save: Option<FormatOnSave>,
|
||||
pub formatter: Option<Formatter>,
|
||||
pub enable_language_server: Option<bool>,
|
||||
}
|
||||
|
||||
#[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<GitSettings>,
|
||||
#[serde(default)]
|
||||
#[serde(alias = "language_overrides")]
|
||||
pub languages: HashMap<Arc<str>, 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(),
|
||||
|
|
|
@ -736,9 +736,9 @@ impl<T: Item> ItemHandle for ViewHandle<T> {
|
|||
|
||||
let debounce_delay = cx
|
||||
.global::<Settings>()
|
||||
.editor_overrides
|
||||
.git
|
||||
.git_gutter
|
||||
.unwrap_or_default()
|
||||
.expect("This should be Some by setting setup")
|
||||
.debounce_delay_millis;
|
||||
let item = item.clone();
|
||||
|
||||
|
|
Loading…
Reference in a new issue