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,
|
SearchOption::Regex => &mut search_view.regex,
|
||||||
};
|
};
|
||||||
*value = !*value;
|
*value = !*value;
|
||||||
|
|
||||||
|
if value.clone() {
|
||||||
|
search_view.semantic = None;
|
||||||
|
}
|
||||||
search_view.search(cx);
|
search_view.search(cx);
|
||||||
});
|
});
|
||||||
cx.notify();
|
cx.notify();
|
||||||
@ -1012,6 +1016,9 @@ impl ProjectSearchBar {
|
|||||||
search_view.semantic = None;
|
search_view.semantic = None;
|
||||||
} else if let Some(semantic_index) = SemanticIndex::global(cx) {
|
} else if let Some(semantic_index) = SemanticIndex::global(cx) {
|
||||||
// TODO: confirm that it's ok to send this project
|
// 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 project = search_view.model.read(cx).project.clone();
|
||||||
let index_task = semantic_index.update(cx, |semantic_index, cx| {
|
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))
|
.with_child(self.render_nav_button(">", Direction::Next, cx))
|
||||||
.aligned(),
|
.aligned(),
|
||||||
)
|
)
|
||||||
.with_child(
|
.with_child({
|
||||||
Flex::row()
|
let row = if SemanticIndex::enabled(cx) {
|
||||||
.with_child(self.render_semantic_search_button(cx))
|
Flex::row().with_child(self.render_semantic_search_button(cx))
|
||||||
|
} else {
|
||||||
|
Flex::row()
|
||||||
|
};
|
||||||
|
|
||||||
|
let row = row
|
||||||
.with_child(self.render_option_button(
|
.with_child(self.render_option_button(
|
||||||
"Case",
|
"Case",
|
||||||
SearchOption::CaseSensitive,
|
SearchOption::CaseSensitive,
|
||||||
@ -1286,8 +1298,10 @@ impl View for ProjectSearchBar {
|
|||||||
))
|
))
|
||||||
.contained()
|
.contained()
|
||||||
.with_style(theme.search.option_button_group)
|
.with_style(theme.search.option_button_group)
|
||||||
.aligned(),
|
.aligned();
|
||||||
)
|
|
||||||
|
row
|
||||||
|
})
|
||||||
.contained()
|
.contained()
|
||||||
.with_margin_bottom(row_spacing),
|
.with_margin_bottom(row_spacing),
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
mod db;
|
mod db;
|
||||||
mod embedding;
|
mod embedding;
|
||||||
mod parsing;
|
mod parsing;
|
||||||
mod semantic_index_settings;
|
pub mod semantic_index_settings;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod semantic_index_tests;
|
mod semantic_index_tests;
|
||||||
@ -183,6 +183,10 @@ impl SemanticIndex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn enabled(cx: &AppContext) -> bool {
|
||||||
|
settings::get::<SemanticIndexSettings>(cx).enabled
|
||||||
|
}
|
||||||
|
|
||||||
async fn new(
|
async fn new(
|
||||||
fs: Arc<dyn Fs>,
|
fs: Arc<dyn Fs>,
|
||||||
database_url: PathBuf,
|
database_url: PathBuf,
|
||||||
|
Loading…
Reference in New Issue
Block a user