mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
fix: Enable disableFuzzySearch config option propagation (#7002)
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
@@ -532,6 +532,7 @@ export async function loadCliConfig(
|
|||||||
respectGeminiIgnore: settings.fileFiltering?.respectGeminiIgnore,
|
respectGeminiIgnore: settings.fileFiltering?.respectGeminiIgnore,
|
||||||
enableRecursiveFileSearch:
|
enableRecursiveFileSearch:
|
||||||
settings.fileFiltering?.enableRecursiveFileSearch,
|
settings.fileFiltering?.enableRecursiveFileSearch,
|
||||||
|
disableFuzzySearch: settings.fileFiltering?.disableFuzzySearch,
|
||||||
},
|
},
|
||||||
checkpointing: argv.checkpointing || settings.checkpointing?.enabled,
|
checkpointing: argv.checkpointing || settings.checkpointing?.enabled,
|
||||||
proxy:
|
proxy:
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ class RecursiveFileSearch implements FileSearch {
|
|||||||
|
|
||||||
async initialize(): Promise<void> {
|
async initialize(): Promise<void> {
|
||||||
this.ignore = loadIgnoreRules(this.options);
|
this.ignore = loadIgnoreRules(this.options);
|
||||||
|
|
||||||
this.allFiles = await crawl({
|
this.allFiles = await crawl({
|
||||||
crawlDirectory: this.options.projectRoot,
|
crawlDirectory: this.options.projectRoot,
|
||||||
cwd: this.options.projectRoot,
|
cwd: this.options.projectRoot,
|
||||||
@@ -116,7 +117,11 @@ class RecursiveFileSearch implements FileSearch {
|
|||||||
pattern: string,
|
pattern: string,
|
||||||
options: SearchOptions = {},
|
options: SearchOptions = {},
|
||||||
): Promise<string[]> {
|
): Promise<string[]> {
|
||||||
if (!this.resultCache || !this.fzf || !this.ignore) {
|
if (
|
||||||
|
!this.resultCache ||
|
||||||
|
(!this.fzf && !this.options.disableFuzzySearch) ||
|
||||||
|
!this.ignore
|
||||||
|
) {
|
||||||
throw new Error('Engine not initialized. Call initialize() first.');
|
throw new Error('Engine not initialized. Call initialize() first.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +136,7 @@ class RecursiveFileSearch implements FileSearch {
|
|||||||
filteredCandidates = candidates;
|
filteredCandidates = candidates;
|
||||||
} else {
|
} else {
|
||||||
let shouldCache = true;
|
let shouldCache = true;
|
||||||
if (pattern.includes('*') || this.options.disableFuzzySearch) {
|
if (pattern.includes('*') || !this.fzf) {
|
||||||
filteredCandidates = await filter(candidates, pattern, options.signal);
|
filteredCandidates = await filter(candidates, pattern, options.signal);
|
||||||
} else {
|
} else {
|
||||||
filteredCandidates = await this.fzf
|
filteredCandidates = await this.fzf
|
||||||
@@ -175,6 +180,7 @@ class RecursiveFileSearch implements FileSearch {
|
|||||||
|
|
||||||
private buildResultCache(): void {
|
private buildResultCache(): void {
|
||||||
this.resultCache = new ResultCache(this.allFiles);
|
this.resultCache = new ResultCache(this.allFiles);
|
||||||
|
if (!this.options.disableFuzzySearch) {
|
||||||
// The v1 algorithm is much faster since it only looks at the first
|
// The v1 algorithm is much faster since it only looks at the first
|
||||||
// occurence of the pattern. We use it for search spaces that have >20k
|
// occurence of the pattern. We use it for search spaces that have >20k
|
||||||
// files, because the v2 algorithm is just too slow in those cases.
|
// files, because the v2 algorithm is just too slow in those cases.
|
||||||
@@ -183,6 +189,7 @@ class RecursiveFileSearch implements FileSearch {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class DirectoryFileSearch implements FileSearch {
|
class DirectoryFileSearch implements FileSearch {
|
||||||
private ignore: Ignore | undefined;
|
private ignore: Ignore | undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user