From f2ab6d08c4cd0ca9a5b3900a6bb66a083c0577ee Mon Sep 17 00:00:00 2001 From: DeWitt Clinton Date: Thu, 12 Jun 2025 07:09:38 -0700 Subject: Improve the performance of filename completion over large repositories. (#938) --- packages/core/src/services/fileDiscoveryService.ts | 12 ++++++++++++ packages/core/src/utils/gitIgnoreParser.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'packages/core/src') diff --git a/packages/core/src/services/fileDiscoveryService.ts b/packages/core/src/services/fileDiscoveryService.ts index 3874e752..f117813d 100644 --- a/packages/core/src/services/fileDiscoveryService.ts +++ b/packages/core/src/services/fileDiscoveryService.ts @@ -7,6 +7,7 @@ import { GitIgnoreParser, GitIgnoreFilter } from '../utils/gitIgnoreParser.js'; import { isGitRepository } from '../utils/gitUtils.js'; import * as path from 'path'; +import fg from 'fast-glob'; export interface FileDiscoveryOptions { respectGitIgnore?: boolean; @@ -32,6 +33,17 @@ export class FileDiscoveryService { } } + async glob( + pattern: string | string[], + options: fg.Options = {}, + ): Promise { + const files = await fg(pattern, { + ...options, + caseSensitiveMatch: false, + }); + return this.filterFiles(files); + } + /** * Filters a list of file paths based on git ignore rules */ diff --git a/packages/core/src/utils/gitIgnoreParser.ts b/packages/core/src/utils/gitIgnoreParser.ts index ae1a7a01..d5d013a8 100644 --- a/packages/core/src/utils/gitIgnoreParser.ts +++ b/packages/core/src/utils/gitIgnoreParser.ts @@ -6,7 +6,7 @@ import * as fs from 'fs/promises'; import * as path from 'path'; -import ignore, { Ignore } from 'ignore'; +import ignore, { type Ignore } from 'ignore'; import { isGitRepository } from './gitUtils.js'; export interface GitIgnoreFilter { -- cgit v1.2.3