Search

Conrad Irwin created

Change summary

crates/collab/src/tests/remote_editing_collaboration_tests.rs |  4 
crates/editor/src/editor_settings.rs                          |  1 
crates/search/src/buffer_search.rs                            | 10 
crates/settings_ui/src/settings_ui.rs                         | 53 ----
crates/vim/src/normal.rs                                      | 12 
5 files changed, 20 insertions(+), 60 deletions(-)

Detailed changes

crates/collab/src/tests/remote_editing_collaboration_tests.rs 🔗

@@ -14,9 +14,7 @@ use gpui::{
 use http_client::BlockedHttpClient;
 use language::{
     FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, LanguageRegistry,
-    language_settings::{
-        Formatter, FormatterList, PrettierSettings, SelectedFormatter, language_settings,
-    },
+    language_settings::{Formatter, FormatterList, SelectedFormatter, language_settings},
     tree_sitter_typescript,
 };
 use node_runtime::NodeRuntime;

crates/editor/src/editor_settings.rs 🔗

@@ -176,6 +176,7 @@ pub struct SearchSettings {
     pub include_ignored: bool,
     pub regex: bool,
 }
+
 impl EditorSettings {
     pub fn jupyter_enabled(cx: &App) -> bool {
         EditorSettings::get_global(cx).jupyter.enabled

crates/search/src/buffer_search.rs 🔗

@@ -1480,7 +1480,7 @@ mod tests {
     use gpui::{Hsla, TestAppContext, UpdateGlobal, VisualTestContext};
     use language::{Buffer, Point};
     use project::Project;
-    use settings::SettingsStore;
+    use settings::{SearchSettingsContent, SettingsStore};
     use smol::stream::StreamExt as _;
     use unindent::Unindent as _;
 
@@ -2867,7 +2867,13 @@ mod tests {
         cx.update(|cx| {
             SettingsStore::update_global(cx, |store, cx| {
                 store.update_user_settings(cx, |settings| {
-                    settings.editor.search = Some(search_settings);
+                    settings.editor.search = Some(SearchSettingsContent {
+                        button: Some(search_settings.button),
+                        whole_word: Some(search_settings.whole_word),
+                        case_sensitive: Some(search_settings.case_sensitive),
+                        include_ignored: Some(search_settings.include_ignored),
+                        regex: Some(search_settings.regex),
+                    });
                 });
             });
         });

crates/settings_ui/src/settings_ui.rs 🔗

@@ -295,57 +295,8 @@ impl SettingsUiTree {
     // so that we can keep none/skip and still test in CI that all settings have
     #[cfg(feature = "test-support")]
     pub fn all_paths(&self, cx: &App) -> Vec<Vec<SharedString>> {
-        fn all_paths_rec(
-            tree: &[UiEntry],
-            paths: &mut Vec<Vec<SharedString>>,
-            current_path: &mut Vec<SharedString>,
-            idx: usize,
-            cx: &App,
-        ) {
-            let child = &tree[idx];
-            let mut pushed_path = false;
-            if let Some(path) = child.path.as_ref() {
-                current_path.push(path.clone());
-                paths.push(current_path.clone());
-                pushed_path = true;
-            }
-            // todo(settings_ui): handle dynamic nodes here
-            let selected_descendant_index = child
-                .dynamic_render
-                .as_ref()
-                .map(|dynamic_render| {
-                    read_settings_value_from_path(
-                        SettingsStore::global(cx).raw_default_settings(),
-                        &current_path,
-                    )
-                    .map(|value| (dynamic_render.determine_option)(value, cx))
-                })
-                .and_then(|selected_descendant_index| {
-                    selected_descendant_index.map(|index| child.nth_descendant_index(tree, index))
-                });
-
-            if let Some(selected_descendant_index) = selected_descendant_index {
-                // just silently fail if we didn't find a setting value for the path
-                if let Some(descendant_index) = selected_descendant_index {
-                    all_paths_rec(tree, paths, current_path, descendant_index, cx);
-                }
-            } else if let Some(desc_idx) = child.first_descendant_index() {
-                let mut desc_idx = Some(desc_idx);
-                while let Some(descendant_index) = desc_idx {
-                    all_paths_rec(&tree, paths, current_path, descendant_index, cx);
-                    desc_idx = tree[descendant_index].next_sibling;
-                }
-            }
-            if pushed_path {
-                current_path.pop();
-            }
-        }
-
-        let mut paths = Vec::new();
-        for &index in &self.root_entry_indices {
-            all_paths_rec(&self.entries, &mut paths, &mut Vec::new(), index, cx);
-        }
-        paths
+        // todo(settings_ui) this needs to be implemented not in terms of JSON anymore
+        Vec::default()
     }
 }
 

crates/vim/src/normal.rs 🔗

@@ -1724,8 +1724,8 @@ mod test {
     async fn test_f_and_t_smartcase(cx: &mut gpui::TestAppContext) {
         let mut cx = VimTestContext::new(cx, true).await;
         cx.update_global(|store: &mut SettingsStore, cx| {
-            store.update_user_settings::<VimSettings>(cx, |s| {
-                s.use_smartcase_find = Some(true);
+            store.update_user_settings(cx, |s| {
+                s.vim.get_or_insert_default().use_smartcase_find = Some(true);
             });
         });
 
@@ -1891,8 +1891,12 @@ mod test {
 
         cx.update(|_, cx| {
             SettingsStore::update_global(cx, |settings, cx| {
-                settings.update_user_settings::<AllLanguageSettings>(cx, |settings| {
-                    settings.defaults.preferred_line_length = Some(5);
+                settings.update_user_settings(cx, |settings| {
+                    settings
+                        .project
+                        .all_languages
+                        .defaults
+                        .preferred_line_length = Some(5);
                 });
             })
         });