669
*/
670
private async searchFilesInLocation(folder: URI, filePattern: string | undefined, token: CancellationToken): Promise<URI[]> {
672
>
if (!this.searchService.schemeHasFileSearchProvider(folder.scheme)) {
673
this.logService.warn(`[PromptFilesLocator] No FileSearchProvider available for scheme '${folder.scheme}'. Cannot search for pattern '${filePattern}' in ${folder.toString()}`);
674
return [];
675
}
677
>
const disregardIgnoreFiles = this.configService.getValue<boolean>('explorer.excludeGitIgnore');
678
>
679
>
const workspaceRoot = this.getWorkspaceFolder(folder);
680
>
681
>
const getExcludePattern = (folder: URI) => getExcludes(this.configService.getValue<ISearchConfiguration>({ resource: folder })) || {};
682
>
const searchOptions: IFileQuery = {
683
>
folderQueries: [{ folder, disregardIgnoreFiles }],
684
>
type: QueryType.File,
685
>
shouldGlobMatchFilePattern: true,
686
>
excludePattern: workspaceRoot ? getExcludePattern(workspaceRoot.uri) : undefined,
687
>
ignoreGlobCase: true,
688
>
sortByScore: true,
689
>
filePattern
690
>
};
691
>
692
>
try {
693
>
const searchResult = await this.searchService.fileSearch(searchOptions, token);
694
>
if (token.isCancellationRequested) {
695
return [];
696
}
698
>
} catch (e) {
699
if (!isCancellationError(e)) {
700
throw e;