Add ability to keybind search filter (#30327)
Useful for large monorepos with many subdirectories, users can keybind a filter to their commonly used directories. Release Notes: - Added a new `included_files` field to the `DeploySearch` action to automatically pre-fill which files to include in the search. This lets you use a keybinding to search in a particular folder or for a certain set of files. --------- Co-authored-by: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
8c8357387e
commit
11b6ce46e2
2 changed files with 10 additions and 0 deletions
|
@ -988,6 +988,12 @@ impl ProjectSearchView {
|
||||||
if let Some(query) = query {
|
if let Some(query) = query {
|
||||||
search.set_query(&query, window, cx);
|
search.set_query(&query, window, cx);
|
||||||
}
|
}
|
||||||
|
if let Some(included_files) = action.included_files.as_deref() {
|
||||||
|
search
|
||||||
|
.included_files_editor
|
||||||
|
.update(cx, |editor, cx| editor.set_text(included_files, window, cx));
|
||||||
|
search.filters_enabled = true;
|
||||||
|
}
|
||||||
search.focus_query_editor(window, cx)
|
search.focus_query_editor(window, cx)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,8 @@ pub struct RevealInProjectPanel {
|
||||||
pub struct DeploySearch {
|
pub struct DeploySearch {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub replace_enabled: bool,
|
pub replace_enabled: bool,
|
||||||
|
#[serde(default)]
|
||||||
|
pub included_files: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_actions!(
|
impl_actions!(
|
||||||
|
@ -200,6 +202,7 @@ impl DeploySearch {
|
||||||
pub fn find() -> Self {
|
pub fn find() -> Self {
|
||||||
Self {
|
Self {
|
||||||
replace_enabled: false,
|
replace_enabled: false,
|
||||||
|
included_files: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3116,6 +3119,7 @@ fn default_render_tab_bar_buttons(
|
||||||
"Search Project",
|
"Search Project",
|
||||||
DeploySearch {
|
DeploySearch {
|
||||||
replace_enabled: false,
|
replace_enabled: false,
|
||||||
|
included_files: None,
|
||||||
}
|
}
|
||||||
.boxed_clone(),
|
.boxed_clone(),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue