Automate settings registration (#42238)
Release Notes: - N/A --------- Co-authored-by: Nia <nia@zed.dev>
This commit is contained in:
@@ -1577,7 +1577,7 @@ pub mod tests {
|
||||
LanguageMatcher,
|
||||
};
|
||||
use lsp::LanguageServerId;
|
||||
use project::Project;
|
||||
|
||||
use rand::{Rng, prelude::*};
|
||||
use settings::{SettingsContent, SettingsStore};
|
||||
use smol::stream::StreamExt;
|
||||
@@ -2966,10 +2966,7 @@ pub mod tests {
|
||||
fn init_test(cx: &mut App, f: impl Fn(&mut SettingsContent)) {
|
||||
let settings = SettingsStore::test(cx);
|
||||
cx.set_global(settings);
|
||||
workspace::init_settings(cx);
|
||||
language::init(cx);
|
||||
crate::init(cx);
|
||||
Project::init_settings(cx);
|
||||
theme::init(LoadThemes::JustBase, cx);
|
||||
cx.update_global::<SettingsStore, _>(|store, cx| {
|
||||
store.update_user_settings(cx, f);
|
||||
|
||||
@@ -310,13 +310,7 @@ pub enum HideMouseCursorOrigin {
|
||||
MovementAction,
|
||||
}
|
||||
|
||||
pub fn init_settings(cx: &mut App) {
|
||||
EditorSettings::register(cx);
|
||||
}
|
||||
|
||||
pub fn init(cx: &mut App) {
|
||||
init_settings(cx);
|
||||
|
||||
cx.set_global(GlobalBlameRenderer(Arc::new(())));
|
||||
|
||||
workspace::register_project_item::<Editor>(cx);
|
||||
|
||||
@@ -8,12 +8,12 @@ pub use settings::{
|
||||
GoToDefinitionFallback, HideMouseMode, MinimapThumb, MinimapThumbBorder, MultiCursorModifier,
|
||||
ScrollBeyondLastLine, ScrollbarDiagnostics, SeedQuerySetting, ShowMinimap, SnippetSortOrder,
|
||||
};
|
||||
use settings::{RelativeLineNumbers, Settings};
|
||||
use settings::{RegisterSetting, RelativeLineNumbers, Settings};
|
||||
use ui::scrollbars::{ScrollbarVisibility, ShowScrollbar};
|
||||
|
||||
/// Imports from the VSCode settings at
|
||||
/// https://code.visualstudio.com/docs/reference/default-settings
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, RegisterSetting)]
|
||||
pub struct EditorSettings {
|
||||
pub cursor_blink: bool,
|
||||
pub cursor_shape: Option<CursorShape>,
|
||||
|
||||
@@ -25700,10 +25700,6 @@ pub(crate) fn init_test(cx: &mut TestAppContext, f: fn(&mut AllLanguageSettingsC
|
||||
cx.set_global(store);
|
||||
theme::init(theme::LoadThemes::JustBase, cx);
|
||||
release_channel::init(SemanticVersion::default(), cx);
|
||||
client::init_settings(cx);
|
||||
language::init(cx);
|
||||
Project::init_settings(cx);
|
||||
workspace::init_settings(cx);
|
||||
crate::init(cx);
|
||||
});
|
||||
zlog::init_test();
|
||||
|
||||
@@ -764,11 +764,6 @@ mod tests {
|
||||
|
||||
theme::init(theme::LoadThemes::JustBase, cx);
|
||||
|
||||
language::init(cx);
|
||||
client::init_settings(cx);
|
||||
workspace::init_settings(cx);
|
||||
Project::init_settings(cx);
|
||||
|
||||
crate::init(cx);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3951,10 +3951,6 @@ let c = 3;"#
|
||||
cx.set_global(settings_store);
|
||||
theme::init(theme::LoadThemes::JustBase, cx);
|
||||
release_channel::init(SemanticVersion::default(), cx);
|
||||
client::init_settings(cx);
|
||||
language::init(cx);
|
||||
Project::init_settings(cx);
|
||||
workspace::init_settings(cx);
|
||||
crate::init(cx);
|
||||
});
|
||||
|
||||
|
||||
@@ -877,7 +877,7 @@ mod tests {
|
||||
};
|
||||
use gpui::{AppContext as _, font, px};
|
||||
use language::Capability;
|
||||
use project::{Project, project_settings::DiagnosticSeverity};
|
||||
use project::project_settings::DiagnosticSeverity;
|
||||
use settings::SettingsStore;
|
||||
use util::post_inc;
|
||||
|
||||
@@ -1346,10 +1346,7 @@ mod tests {
|
||||
fn init_test(cx: &mut gpui::App) {
|
||||
let settings_store = SettingsStore::test(cx);
|
||||
cx.set_global(settings_store);
|
||||
workspace::init_settings(cx);
|
||||
theme::init(theme::LoadThemes::JustBase, cx);
|
||||
language::init(cx);
|
||||
crate::init(cx);
|
||||
Project::init_settings(cx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,10 +54,8 @@ impl EditorLspTestContext {
|
||||
|
||||
cx.update(|cx| {
|
||||
assets::Assets.load_test_fonts(cx);
|
||||
language::init(cx);
|
||||
crate::init(cx);
|
||||
workspace::init(app_state.clone(), cx);
|
||||
Project::init_settings(cx);
|
||||
});
|
||||
|
||||
let file_name = format!(
|
||||
|
||||
Reference in New Issue
Block a user