extensionsProfileScannerService.ts ×8

Frontier kind: Code frontier

unlabeled · c_71080390653e

18 tests · 17115 LOC · 73 files · introduces 0 tests · 41 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges41 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2573 ranges17115 lines · 73 files · Browse complete extent
All tests (intent)
18 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: 41 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/extensionManagement/common/extensionsProfileScannerService.ts 41 introduced LOC · 8 ranges

Open complete file

120
121 async addExtensionsToProfile(extensions: [IExtension, Metadata | undefined][], profileLocation: URI, keepExistingVersions?: boolean): Promise<IScannedProfileExtension[]> {
122 > const extensionsToRemove: IScannedProfileExtension[] = []; extensionsProfileScannerService.ts
123 > const extensionsToAdd: IScannedProfileExtension[] = [];
124 > try {
125 > await this.withProfileExtensions(profileLocation, existingExtensions => {
126 > const result: IScannedProfileExtension[] = [];
127 > if (keepExistingVersions) {
128 result.push(...existingExtensions);
130 > for (const existing of existingExtensions) {
131 if (extensions.some(([e]) => areSameExtensions(e.identifier, existing.identifier) && e.manifest.version !== existing.version)) {
132 // Remove the existing extension with different version
136 }
137 }
139 > for (const [extension, metadata] of extensions) {
140 > const index = result.findIndex(e => areSameExtensions(e.identifier, extension.identifier) && e.version === extension.manifest.version);
141 > const extensionToAdd = { identifier: extension.identifier, version: extension.manifest.version, location: extension.location, metadata };
142 > if (index === -1) {
143 > extensionsToAdd.push(extensionToAdd);
144 > result.push(extensionToAdd);
145 > } else {
146 result.splice(index, 1, extensionToAdd);
147 }
149 > if (extensionsToAdd.length) {
150 > this._onAddExtensions.fire({ extensions: extensionsToAdd, profileLocation });
151 > }
152 > if (extensionsToRemove.length) {
153 this._onRemoveExtensions.fire({ extensions: extensionsToRemove, profileLocation });
154 }
155 > return result; extensionsProfileScannerService.ts
156 > });
157 > if (extensionsToAdd.length) {
158 > this._onDidAddExtensions.fire({ extensions: extensionsToAdd, profileLocation });
159 > }
160 > if (extensionsToRemove.length) {
161 this._onDidRemoveExtensions.fire({ extensions: extensionsToRemove, profileLocation });
162 }
163 > return extensionsToAdd; extensionsProfileScannerService.ts
164 > } catch (error) {
165 if (extensionsToAdd.length) {
166 this._onDidAddExtensions.fire({ extensions: extensionsToAdd, error, profileLocation });
171 throw error;
172 }
174
175 async updateMetadata(extensions: [IExtension, Metadata][], profileLocation: URI): Promise<IScannedProfileExtension[]> {
286 // Update
287 if (updateFn) {
288 > extensions = updateFn(extensions); extensionsProfileScannerService.ts
289 > const storedProfileExtensions: IStoredProfileExtension[] = extensions.map(e => ({
290 > identifier: e.identifier,
291 > version: e.version,
292 > // retain old format so that old clients can read it
293 > location: e.location.toJSON(),
294 > relativeLocation: this.toRelativePath(e.location),
295 > metadata: e.metadata
296 > }));
297 > await this.fileService.writeFile(file, VSBuffer.fromString(JSON.stringify(storedProfileExtensions)));
298 > }
299
300 return extensions;