Rename regex search tool to grep and accept an include glob pattern (#29100)
This PR renames the `regex_search` tool to `grep` because I think it conveys more meaning to the model, the idea of searching the filesystem with a regular expression. It's also one word and the model seems to be using it effectively after some additional prompt tuning. It also takes an include pattern to filter on the specific files we try to search. I'd like to encourage the model to scope its searches more aggressively, as in my testing, I'm only seeing it filter on file extension. Release Notes: - N/A
This commit is contained in:
parent
4278d894d2
commit
107d8ca483
29 changed files with 579 additions and 390 deletions
|
@ -1252,6 +1252,7 @@ impl BufferSearchBar {
|
|||
.contains(SearchOptions::ONE_MATCH_PER_LINE),
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
false,
|
||||
None,
|
||||
) {
|
||||
Ok(query) => query.with_replacement(self.replacement(cx)),
|
||||
|
@ -1270,6 +1271,7 @@ impl BufferSearchBar {
|
|||
false,
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
false,
|
||||
None,
|
||||
) {
|
||||
Ok(query) => query.with_replacement(self.replacement(cx)),
|
||||
|
|
|
@ -1047,6 +1047,19 @@ impl ProjectSearchView {
|
|||
}
|
||||
};
|
||||
|
||||
// If the project contains multiple visible worktrees, we match the
|
||||
// include/exclude patterns against full paths to allow them to be
|
||||
// disambiguated. For single worktree projects we use worktree relative
|
||||
// paths for convenience.
|
||||
let match_full_paths = self
|
||||
.entity
|
||||
.read(cx)
|
||||
.project
|
||||
.read(cx)
|
||||
.visible_worktrees(cx)
|
||||
.count()
|
||||
> 1;
|
||||
|
||||
let query = if self.search_options.contains(SearchOptions::REGEX) {
|
||||
match SearchQuery::regex(
|
||||
text,
|
||||
|
@ -1057,6 +1070,7 @@ impl ProjectSearchView {
|
|||
.contains(SearchOptions::ONE_MATCH_PER_LINE),
|
||||
included_files,
|
||||
excluded_files,
|
||||
match_full_paths,
|
||||
open_buffers,
|
||||
) {
|
||||
Ok(query) => {
|
||||
|
@ -1084,6 +1098,7 @@ impl ProjectSearchView {
|
|||
self.search_options.contains(SearchOptions::INCLUDE_IGNORED),
|
||||
included_files,
|
||||
excluded_files,
|
||||
match_full_paths,
|
||||
open_buffers,
|
||||
) {
|
||||
Ok(query) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue