extensionsScannerService.ts ×7

Frontier kind: Code frontier

unlabeled · c_b86355bc53ef

19 tests · 18684 LOC · 82 files · introduces 0 tests · 41 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
13 ranges41 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2897 ranges18684 lines · 82 files · Browse complete extent
All tests (intent)
19 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.

3 files ranked by introduced lines: 41 introduced LOC across 13 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/extensionManagement/common/extensionManagementUtil.ts 21 introduced LOC · 5 ranges

Open complete file

172 }
173
174 > async function isAlpineLinux(fileService: IFileService, logService: ILogService): Promise<boolean> { extensionManagementUtil.ts
175 > if (!isLinux) {
176 return false;
177 }
178 > let content: string | undefined; extensionManagementUtil.ts
179 > try {
180 > const fileContent = await fileService.readFile(URI.file('/etc/os-release'));
181 content = fileContent.value.toString();
182 > } catch (error) { extensionManagementUtil.ts
183 > try {
184 > const fileContent = await fileService.readFile(URI.file('/usr/lib/os-release'));
185 content = fileContent.value.toString();
186 > } catch (error) { extensionManagementUtil.ts
187 > /* Ignore */
188 > logService.debug(`Error while getting the os-release file.`, getErrorMessage(error));
189 > }
190 > }
191 > return !!content && (content.match(/^ID=([^\u001b\r\n]*)/m) || [])[1] === 'alpine';
192 > }
193
194 > export async function computeTargetPlatform(fileService: IFileService, logService: ILogService): Promise<TargetPlatform> { extensionManagementUtil.ts
195 > const alpineLinux = await isAlpineLinux(fileService, logService);
196 > const targetPlatform = getTargetPlatform(alpineLinux ? 'alpine' : platform, arch);
197 > logService.debug('ComputeTargetPlatform:', targetPlatform);
198 > return targetPlatform;
199 > }
200
201 export function isMalicious(identifier: IExtensionIdentifier, malicious: ReadonlyArray<MaliciousExtensionInfo>): boolean {
src/vs/platform/extensionManagement/common/extensionsScannerService.ts 18 introduced LOC · 7 ranges

Open complete file

199 private _targetPlatformPromise: Promise<TargetPlatform> | undefined;
200 private getTargetPlatform(): Promise<TargetPlatform> {
201 > if (!this._targetPlatformPromise) { extensionsScannerService.ts
202 > this._targetPlatformPromise = computeTargetPlatform(this.fileService, this.logService);
203 > }
204 > return this._targetPlatformPromise;
205 > }
206
207 async scanAllExtensions(systemScanOptions: SystemExtensionsScanOptions, userScanOptions: UserExtensionsScanOptions): Promise<IScannedExtension[]> {
353 private async applyScanOptions(extensions: IRelaxedScannedExtension[], type: ExtensionType | 'development', scanOptions: { includeAllVersions?: boolean; includeInvalid?: boolean; pickLatest?: boolean } = {}): Promise<IRelaxedScannedExtension[]> {
354 if (!scanOptions.includeAllVersions) {
355 > extensions = this.dedupExtensions(type === ExtensionType.System ? extensions : undefined, type === ExtensionType.User ? extensions : undefined, type === 'development' ? extensions : undefined, await this.getTargetPlatform(), !!scanOptions.pickLatest); extensionsScannerService.ts
356 > }
357 if (!scanOptions.includeInvalid) {
358 extensions = extensions.filter(extension => extension.isValid);
372
373 private dedupExtensions(system: IScannedExtension[] | undefined, user: IScannedExtension[] | undefined, development: IScannedExtension[] | undefined, targetPlatform: TargetPlatform, pickLatest: boolean): IScannedExtension[] {
374 > const pick = (existing: IScannedExtension, extension: IScannedExtension, isDevelopment: boolean): boolean => { extensionsScannerService.ts
375 if (!isDevelopment && !(existing.isBuiltin || extension.isBuiltin)) {
376 if (existing.metadata?.isApplicationScoped && !extension.metadata?.isApplicationScoped) {
407 return true;
408 };
409 > const result = new ExtensionIdentifierMap<IScannedExtension>(); extensionsScannerService.ts
410 > system?.forEach((extension) => {
411 const existing = result.get(extension.identifier.id);
412 if (!existing || pick(existing, extension, false)) {
413 result.set(extension.identifier.id, extension);
414 }
416 > const productBuiltInExtensionsEnabledWithAutoUpdates = getProductBuiltInExtensionsEnabledWithAutoUpdates(this.productService, this.environmentService);
417 > user?.forEach((extension) => {
418 const existing = result.get(extension.identifier.id);
419 if (!existing && system && extension.type === ExtensionType.System) {
428 result.set(extension.identifier.id, extension);
429 }
431 > development?.forEach(extension => {
432 const existing = result.get(extension.identifier.id);
433 if (!existing || pick(existing, extension, true)) {
435 }
436 result.set(extension.identifier.id, extension);
438 > return [...result.values()];
439 > }
440
441 private async scanDefaultSystemExtensions(language: string | undefined): Promise<IRelaxedScannedExtension[]> {
src/vs/platform/extensions/common/extensions.ts 2 introduced LOC · 1 range

Open complete file

492
493 public values(): IterableIterator<T> {
494 > return this._map.values(); extensions.ts
495 > }
496
497 forEach(callbackfn: (value: T, key: string, map: Map<string, T>) => void): void {