promptsSync.ts ×11

Frontier kind: Code frontier

unlabeled · c_02b77fc62cac

67 tests · 25753 LOC · 133 files · introduces 0 tests · 56 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges56 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4134 ranges25753 lines · 133 files · Browse complete extent
All tests (intent)
67 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.

1 file ranked by introduced lines: 56 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/userDataSync/common/promptsSync/promptsSync.ts 56 introduced LOC · 11 ranges

Open complete file

110
111 protected async getMergeResult(resourcePreview: IPromptsResourcePreview, token: CancellationToken): Promise<IMergeResult> {
112 > return resourcePreview.previewResult; promptsSync.ts
113 > }
114
115 protected async getAcceptResult(resourcePreview: IPromptsResourcePreview, resource: URI, content: string | null | undefined, token: CancellationToken): Promise<IAcceptResult> {
117 > /* Accept local resource */
118 > if (this.extUri.isEqualOrParent(resource, this.syncPreviewFolder.with({ scheme: USER_DATA_SYNC_SCHEME, authority: 'local' }))) {
119 return {
120 content: resourcePreview.fileContent ? resourcePreview.fileContent.value.toString() : null,
125 };
126 }
128 > /* Accept remote resource */
129 > if (this.extUri.isEqualOrParent(resource, this.syncPreviewFolder.with({ scheme: USER_DATA_SYNC_SCHEME, authority: 'remote' }))) {
130 return {
131 content: resourcePreview.remoteContent,
136 };
137 }
139 > /* Accept preview resource */
140 > if (this.extUri.isEqualOrParent(resource, this.syncPreviewFolder)) {
141 > if (content === undefined) {
142 > return {
143 > content: resourcePreview.previewResult.content,
144 > localChange: resourcePreview.previewResult.localChange,
145 > remoteChange: resourcePreview.previewResult.remoteChange,
146 > };
147 > } else {
148 return {
149 content,
156 };
157 }
158 > } promptsSync.ts
159
160 throw new Error(`Invalid Resource: ${resource.toString()}`);
161 > } promptsSync.ts
162
163 protected async applyResult(remoteUserData: IRemoteUserData, lastSyncUserData: IRemoteUserData | null, resourcePreviews: [IPromptsResourcePreview, IAcceptResult][], force: boolean): Promise<void> {
277 /* Prompts added locally -> add remotely */
278 for (const key of Object.keys(mergeResult.remote.added)) {
279 > const previewResult: IMergeResult = { promptsSync.ts
280 > content: mergeResult.remote.added[key],
281 > hasConflicts: false,
282 > localChange: Change.None,
283 > remoteChange: Change.Added,
284 > };
285 > const localContent = localFileContent[key] ? localFileContent[key].value.toString() : null;
286 > resourcePreviews.set(key, {
287 > baseResource: this.extUri.joinPath(this.syncPreviewFolder, key).with({ scheme: USER_DATA_SYNC_SCHEME, authority: 'base' }),
288 > baseContent: base[key] ?? null,
289 > localResource: this.extUri.joinPath(this.syncPreviewFolder, key).with({ scheme: USER_DATA_SYNC_SCHEME, authority: 'local' }),
290 > fileContent: localFileContent[key],
291 > localContent,
292 > remoteResource: this.extUri.joinPath(this.syncPreviewFolder, key).with({ scheme: USER_DATA_SYNC_SCHEME, authority: 'remote' }),
293 > remoteContent: null,
294 > previewResource: this.extUri.joinPath(this.syncPreviewFolder, key),
295 > previewResult,
296 > localChange: previewResult.localChange,
297 > remoteChange: previewResult.remoteChange,
298 > acceptedResource: this.extUri.joinPath(this.syncPreviewFolder, key).with({ scheme: USER_DATA_SYNC_SCHEME, authority: 'accepted' })
299 > });
300 > }
301
302 /* Prompts updated locally -> update remotely */
376 /* Unmodified Prompts */
377 for (const key of Object.keys(localFileContent)) {
378 > if (!resourcePreviews.has(key)) { promptsSync.ts
379 const previewResult: IMergeResult = {
380 content: localFileContent[key] ? localFileContent[key].value.toString() : null,
399 });
400 }
401 > } promptsSync.ts
402
403 return [...resourcePreviews.values()];
497 const prompts: IStringDictionary<string> = {};
498 for (const key of Object.keys(fileContents)) {
499 > prompts[key] = fileContents[key].value.toString(); promptsSync.ts
500 > }
501 return prompts;
502 }
516 }
517 for (const entry of stat.children || []) {
518 > const resource = entry.resource; promptsSync.ts
519 > const path = resource.path;
520 > if (['.prompt.md', '.instructions.md', '.chatmode.md', '.agent.md'].some(ext => path.endsWith(ext))) {
521 > const key = this.extUri.relativePath(this.promptsFolder, resource)!;
522 > const content = await this.fileService.readFile(resource);
523 > prompts[key] = content;
524 > }
525 > }
526 >
527 > return prompts;
528 }
529 }