feat(filesearch): Introduce non-recursive file search strategy (#6087)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
Co-authored-by: Bryant Chandler <bryantchandler@chromium.org>
This commit is contained in:
Bryant Chandler
2025-08-18 13:43:24 -07:00
committed by GitHub
parent 274898d6f5
commit 96affd7e49
8 changed files with 1033 additions and 430 deletions
+9 -5
View File
@@ -5,7 +5,12 @@
*/
import { useEffect, useReducer, useRef } from 'react';
import { Config, FileSearch, escapePath } from '@google/gemini-cli-core';
import {
Config,
FileSearch,
FileSearchFactory,
escapePath,
} from '@google/gemini-cli-core';
import {
Suggestion,
MAX_SUGGESTIONS_TO_SHOW,
@@ -156,7 +161,7 @@ export function useAtCompletion(props: UseAtCompletionProps): void {
useEffect(() => {
const initialize = async () => {
try {
const searcher = new FileSearch({
const searcher = FileSearchFactory.create({
projectRoot: cwd,
ignoreDirs: [],
useGitignore:
@@ -165,9 +170,8 @@ export function useAtCompletion(props: UseAtCompletionProps): void {
config?.getFileFilteringOptions()?.respectGeminiIgnore ?? true,
cache: true,
cacheTtl: 30, // 30 seconds
maxDepth: !(config?.getEnableRecursiveFileSearch() ?? true)
? 0
: undefined,
enableRecursiveFileSearch:
config?.getEnableRecursiveFileSearch() ?? true,
});
await searcher.initialize();
fileSearch.current = searcher;