248
return result;
249
}
251
>
for (const providerEntry of providers) {
252
>
try {
253
>
const files = await providerEntry.providePromptFiles({}, token);
254
>
this._providerWhenClauses.set(providerEntry, files?.flatMap(file => file.when ? [file.when] : []) ?? []);
255
>
this._updateContributedWhenKeys();
256
>
if (!files || token.isCancellationRequested) {
257
continue;
258
}
260
>
for (const file of files) {
261
>
readonlyUris.push(file.uri);
262
>
result.push({
263
>
uri: file.uri,
264
>
storage: PromptsStorage.extension,
265
>
type,
266
>
extension: providerEntry.extension,
267
>
source: PromptFileSource.ExtensionAPI,
268
>
name: file.name,
269
>
description: file.description,
270
>
when: file.when,
271
>
sessionTypes: file.sessionTypes,
272
>
} satisfies IExtensionPromptPath);
273
>
}
274
>
} catch (e) {
275
this.logger.error(`[listFromProviders] Failed to get ${type} files from provider`, e instanceof Error ? e.message : String(e));
276
}
278
>
279
>
// Mark all collected files as readonly in a single batch to avoid
280
>
// firing onDidChangeReadonly once per file (which causes a cascade
281
>
// of event handlers and can freeze the renderer).
282
>
void this.filesConfigService.updateReadonly(readonlyUris, true);
283
>
284
>
return result;
285
}
286