perf(filesearch): Use async fzf for non-blocking file search (#5771)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
Bryant Chandler
2025-08-07 15:24:55 -07:00
committed by GitHub
parent c38147a3a6
commit 9fc7115b86
3 changed files with 33 additions and 24 deletions

View File

@@ -157,7 +157,7 @@ describe('useAtCompletion', () => {
});
});
it('should NOT show a loading indicator for subsequent searches that complete under 100ms', async () => {
it('should NOT show a loading indicator for subsequent searches that complete under 200ms', async () => {
const structure: FileSystemStructure = { 'a.txt': '', 'b.txt': '' };
testRootDir = await createTmpDir(structure);
@@ -186,7 +186,7 @@ describe('useAtCompletion', () => {
expect(result.current.isLoadingSuggestions).toBe(false);
});
it('should show a loading indicator and clear old suggestions for subsequent searches that take longer than 100ms', async () => {
it('should show a loading indicator and clear old suggestions for subsequent searches that take longer than 200ms', async () => {
const structure: FileSystemStructure = { 'a.txt': '', 'b.txt': '' };
testRootDir = await createTmpDir(structure);
@@ -194,7 +194,7 @@ describe('useAtCompletion', () => {
const originalSearch = FileSearch.prototype.search;
vi.spyOn(FileSearch.prototype, 'search').mockImplementation(
async function (...args) {
await new Promise((resolve) => setTimeout(resolve, 200));
await new Promise((resolve) => setTimeout(resolve, 300));
return originalSearch.apply(this, args);
},
);

View File

@@ -194,7 +194,7 @@ export function useAtCompletion(props: UseAtCompletionProps): void {
slowSearchTimer.current = setTimeout(() => {
dispatch({ type: 'SET_LOADING', payload: true });
}, 100);
}, 200);
try {
const results = await fileSearch.current.search(state.pattern, {