diff --git a/assets/settings/default.json b/assets/settings/default.json index 86def54d32..22ea266533 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -370,8 +370,7 @@ }, // Difference settings for semantic_index "semantic_index": { - "enabled": false, - "reindexing_delay_seconds": 600 + "enabled": false }, // Different settings for specific languages. "languages": { diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 74fc83b0fa..69587f856e 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -71,9 +71,9 @@ pub fn init(cx: &mut AppContext) { cx.add_action(ProjectSearchBar::activate_text_mode); // This action should only be registered if the semantic index is enabled - if SemanticIndex::enabled(cx) { - cx.add_action(ProjectSearchBar::activate_semantic_mode); - } + // We are registering it all the time, as I dont want to introduce a dependency + // for Semantic Index Settings globally whenever search is tested. + cx.add_action(ProjectSearchBar::activate_semantic_mode); cx.capture_action(ProjectSearchBar::tab); cx.capture_action(ProjectSearchBar::tab_previous); @@ -1449,15 +1449,17 @@ impl ProjectSearchBar { _: &ActivateSemanticMode, cx: &mut ViewContext, ) { - if let Some(search_view) = pane - .active_item() - .and_then(|item| item.downcast::()) - { - search_view.update(cx, |view, cx| { - view.activate_search_mode(SearchMode::Semantic, cx) - }); - } else { - cx.propagate_action(); + if SemanticIndex::enabled(cx) { + if let Some(search_view) = pane + .active_item() + .and_then(|item| item.downcast::()) + { + search_view.update(cx, |view, cx| { + view.activate_search_mode(SearchMode::Semantic, cx) + }); + } else { + cx.propagate_action(); + } } } diff --git a/crates/semantic_index/src/semantic_index_settings.rs b/crates/semantic_index/src/semantic_index_settings.rs index 86872457f8..dcfe05bab8 100644 --- a/crates/semantic_index/src/semantic_index_settings.rs +++ b/crates/semantic_index/src/semantic_index_settings.rs @@ -6,13 +6,11 @@ use settings::Setting; #[derive(Deserialize, Debug)] pub struct SemanticIndexSettings { pub enabled: bool, - pub reindexing_delay_seconds: usize, } #[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)] pub struct SemanticIndexSettingsContent { pub enabled: Option, - pub reindexing_delay_seconds: Option, } impl Setting for SemanticIndexSettings { diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 98bf600a61..d22e26c1f5 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -156,8 +156,8 @@ fn main() { project_panel::init(Assets, cx); channel::init(&client); diagnostics::init(cx); - semantic_index::init(fs.clone(), http.clone(), languages.clone(), cx); search::init(cx); + semantic_index::init(fs.clone(), http.clone(), languages.clone(), cx); vim::init(cx); terminal_view::init(cx); copilot::init(copilot_language_server_id, http.clone(), node_runtime, cx);