extensionPromptFileService.ts ×7

Frontier kind: Code frontier

unlabeled · c_9774098ad180

10 tests · 67490 LOC · 326 files · introduces 0 tests · 64 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges64 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
6446 ranges67490 lines · 326 files · Browse complete extent
All tests (intent)
10 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 64 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.ts 59 introduced LOC · 7 ranges

Open complete file

206 */
207 public registerPromptFileProvider(extension: IExtensionDescription, type: PromptsType, provider: {
208 > onDidChangePromptFiles?: Event<void>; extensionPromptFileService.ts
209 > providePromptFiles: (context: IPromptFileContext, token: CancellationToken) => Promise<IPromptFileResource[] | undefined>;
210 > }): IDisposable {
211 > const providerEntry: PromptFileProviderEntry = { extension, type, ...provider };
212 > this._promptFileProviders.push(providerEntry);
213 >
214 > const disposables = new DisposableStore();
215 >
216 > if (provider.onDidChangePromptFiles) {
217 disposables.add(provider.onDidChangePromptFiles(() => {
218 this._onDidChange.fire({ type });
219 }));
220 }
222 > this._onDidChange.fire({ type });
223 >
224 > disposables.add({
225 > dispose: () => {
226 > const index = this._promptFileProviders.findIndex(p => p === providerEntry);
227 > if (index >= 0) {
228 > this._promptFileProviders.splice(index, 1);
229 > this._providerWhenClauses.delete(providerEntry);
230 > this._updateContributedWhenKeys();
231 > this._onDidChange.fire({ type });
232 > }
233 > }
234 > });
235 >
236 > return disposables;
237 > }
238
239 private async _listFromProviders(type: PromptsType, activationEvent: string, token: CancellationToken): Promise<IExtensionPromptPath[]> {
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
322 }
323 for (const whenClauses of this._providerWhenClauses.values()) {
324 > for (const whenClause of whenClauses) { extensionPromptFileService.ts
325 const expr = ContextKeyExpr.deserialize(whenClause);
326 for (const key of expr?.keys() ?? []) {
src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts 5 introduced LOC · 1 range

Open complete file

362 */
363 public registerPromptFileProvider(extension: IExtensionDescription, type: PromptsType, provider: {
364 > onDidChangePromptFiles?: Event<void>; promptsServiceImpl.ts
365 > providePromptFiles: (context: IPromptFileContext, token: CancellationToken) => Promise<IPromptFileResource[] | undefined>;
366 > }): IDisposable {
367 > return this.extensionPromptFiles.registerPromptFileProvider(extension, type, provider);
368 > }
369
370