Automate settings registration (#42238)
Release Notes: - N/A --------- Co-authored-by: Nia <nia@zed.dev>
This commit is contained in:
@@ -3922,7 +3922,6 @@ fn assert_bracket_pairs(
|
||||
fn init_settings(cx: &mut App, f: fn(&mut AllLanguageSettingsContent)) {
|
||||
let settings_store = SettingsStore::test(cx);
|
||||
cx.set_global(settings_store);
|
||||
crate::init(cx);
|
||||
cx.update_global::<SettingsStore, _>(|settings, cx| {
|
||||
settings.update_user_settings(cx, |content| f(&mut content.project.all_languages));
|
||||
});
|
||||
|
||||
@@ -88,13 +88,6 @@ pub use syntax_map::{
|
||||
pub use text::{AnchorRangeExt, LineEnding};
|
||||
pub use tree_sitter::{Node, Parser, Tree, TreeCursor};
|
||||
|
||||
/// Initializes the `language` crate.
|
||||
///
|
||||
/// This should be called before making use of items from the create.
|
||||
pub fn init(cx: &mut App) {
|
||||
language_settings::init(cx);
|
||||
}
|
||||
|
||||
static QUERY_CURSORS: Mutex<Vec<QueryCursor>> = Mutex::new(vec![]);
|
||||
static PARSERS: Mutex<Vec<Parser>> = Mutex::new(vec![]);
|
||||
|
||||
|
||||
@@ -15,15 +15,10 @@ pub use settings::{
|
||||
Formatter, FormatterList, InlayHintKind, LanguageSettingsContent, LspInsertMode,
|
||||
RewrapBehavior, ShowWhitespaceSetting, SoftWrap, WordsCompletionMode,
|
||||
};
|
||||
use settings::{Settings, SettingsLocation, SettingsStore};
|
||||
use settings::{RegisterSetting, Settings, SettingsLocation, SettingsStore};
|
||||
use shellexpand;
|
||||
use std::{borrow::Cow, num::NonZeroU32, path::Path, sync::Arc};
|
||||
|
||||
/// Initializes the language settings.
|
||||
pub fn init(cx: &mut App) {
|
||||
AllLanguageSettings::register(cx);
|
||||
}
|
||||
|
||||
/// Returns the settings for the specified language from the provided file.
|
||||
pub fn language_settings<'a>(
|
||||
language: Option<LanguageName>,
|
||||
@@ -50,7 +45,7 @@ pub fn all_language_settings<'a>(
|
||||
}
|
||||
|
||||
/// The settings for all languages.
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, RegisterSetting)]
|
||||
pub struct AllLanguageSettings {
|
||||
/// The edit prediction settings.
|
||||
pub edit_predictions: EditPredictionSettings,
|
||||
|
||||
Reference in New Issue
Block a user