715
// Check if a FileSearchProvider is available for this scheme
716
if (this.searchService.schemeHasFileSearchProvider(folder.scheme)) {
718
>
const disregardIgnoreFiles = this.configService.getValue<boolean>('explorer.excludeGitIgnore');
719
>
const getExcludePattern = (folder: URI) => getExcludes(this.configService.getValue<ISearchConfiguration>({ resource: folder })) || {};
720
>
const searchOptions: IFileQuery = {
721
>
folderQueries: [{ folder, disregardIgnoreFiles }],
722
>
type: QueryType.File,
723
>
shouldGlobMatchFilePattern: true,
724
>
excludePattern: getExcludePattern(folder),
725
>
filePattern: '**/AGENTS.md',
726
>
ignoreGlobCase: true,
727
>
};
728
>
729
>
try {
730
>
const searchResult = await this.searchService.fileSearch(searchOptions, token);
731
>
if (token.isCancellationRequested) {
732
return [];
733
}
735
>
const results: IAgentInstructionFile[] = [];
736
>
for (const r of searchResult.results) {
737
>
const realPath = undefined; // We can skip realpath resolution here for performance; duplicates can be handled later if needed
738
>
results.push({ uri: r.resource, realPath, type: AgentInstructionFileType.agentsMd });
739
>
}
740
>
return results;
741
>
} catch (e) {
742
if (!isCancellationError(e)) {
743
throw e;