Improve the performance of filename completion over large repositories. (#938)

This commit is contained in:
DeWitt Clinton
2025-06-12 07:09:38 -07:00
committed by GitHub
parent 9072a4e5ee
commit f2ab6d08c4
6 changed files with 84 additions and 11 deletions

View File

@@ -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<string[]> {
const files = await fg(pattern, {
...options,
caseSensitiveMatch: false,
});
return this.filterFiles(files);
}
/**
* Filters a list of file paths based on git ignore rules
*/

View File

@@ -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 {