mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
update project search to only show semantic button visible with semantic_index enabled
This commit is contained in:
parent
e8210b827d
commit
75999204ad
@ -996,6 +996,10 @@ impl ProjectSearchBar {
|
||||
SearchOption::Regex => &mut search_view.regex,
|
||||
};
|
||||
*value = !*value;
|
||||
|
||||
if value.clone() {
|
||||
search_view.semantic = None;
|
||||
}
|
||||
search_view.search(cx);
|
||||
});
|
||||
cx.notify();
|
||||
@ -1012,6 +1016,9 @@ impl ProjectSearchBar {
|
||||
search_view.semantic = None;
|
||||
} else if let Some(semantic_index) = SemanticIndex::global(cx) {
|
||||
// TODO: confirm that it's ok to send this project
|
||||
search_view.regex = false;
|
||||
search_view.case_sensitive = false;
|
||||
search_view.whole_word = false;
|
||||
|
||||
let project = search_view.model.read(cx).project.clone();
|
||||
let index_task = semantic_index.update(cx, |semantic_index, cx| {
|
||||
@ -1266,9 +1273,14 @@ impl View for ProjectSearchBar {
|
||||
.with_child(self.render_nav_button(">", Direction::Next, cx))
|
||||
.aligned(),
|
||||
)
|
||||
.with_child(
|
||||
.with_child({
|
||||
let row = if SemanticIndex::enabled(cx) {
|
||||
Flex::row().with_child(self.render_semantic_search_button(cx))
|
||||
} else {
|
||||
Flex::row()
|
||||
.with_child(self.render_semantic_search_button(cx))
|
||||
};
|
||||
|
||||
let row = row
|
||||
.with_child(self.render_option_button(
|
||||
"Case",
|
||||
SearchOption::CaseSensitive,
|
||||
@ -1286,8 +1298,10 @@ impl View for ProjectSearchBar {
|
||||
))
|
||||
.contained()
|
||||
.with_style(theme.search.option_button_group)
|
||||
.aligned(),
|
||||
)
|
||||
.aligned();
|
||||
|
||||
row
|
||||
})
|
||||
.contained()
|
||||
.with_margin_bottom(row_spacing),
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
mod db;
|
||||
mod embedding;
|
||||
mod parsing;
|
||||
mod semantic_index_settings;
|
||||
pub mod semantic_index_settings;
|
||||
|
||||
#[cfg(test)]
|
||||
mod semantic_index_tests;
|
||||
@ -183,6 +183,10 @@ impl SemanticIndex {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn enabled(cx: &AppContext) -> bool {
|
||||
settings::get::<SemanticIndexSettings>(cx).enabled
|
||||
}
|
||||
|
||||
async fn new(
|
||||
fs: Arc<dyn Fs>,
|
||||
database_url: PathBuf,
|
||||
|
Loading…
Reference in New Issue
Block a user