src/vs/platform/extensionManagement/node/extensionManagementService.ts/ExtensionManagementService/getAllDepsAndPackExtensionsToInstall
class ExtensionManagementService:	private async getAllDepsAndPackExtensionsToInstall(extensionIdentifier: IExtensionIdentifier, manifest: IExtensionManifest, token: CancellationToken): Promise<{ gallery: IGalleryExtension, manifest: IExtensionManifest }[]> {
		let installed = await this.getInstalled();
		const knownIdentifiers = [extensionIdentifier, ...(installed).map(i => i.identifier)];

		const allDependenciesAndPacks: { gallery: IGalleryExtension, manifest: IExtensionManifest }[] = [];
		const collectDependenciesAndPackExtensionsToInstall = async (extensionIdentifier: IExtensionIdentifier, manifest: IExtensionManifest): Promise<void> => {
			const dependenciesAndPackExtensions: string[] = manifest.extensionDependencies || [];
			if (manifest.extensionPack) {
				const existing = installed.find(e => areSameExtensions(e.identifier, extensionIdentifier));
				for (const extension of manifest.extensionPack) {
					// add only those extensions which are new in currently installed extension
					if (!(existing && existing.manifest.extensionPack && existing.manifest.extensionPack.some(old => areSameExtensions({ id: old }, { id: extension })))) {
						if (dependenciesAndPackExtensions.every(e => !areSameExtensions({ id: e }, { id: extension }))) {
							dependenciesAndPackExtensions.push(extension);
						}
					}
				}
			}

			if (dependenciesAndPackExtensions.length) {
				// filter out installed and known extensions
				const identifiers = [...knownIdentifiers, ...allDependenciesAndPacks.map(r => r.gallery.identifier)];
				const names = dependenciesAndPackExtensions.filter(id => identifiers.every(galleryIdentifier => !areSameExtensions(galleryIdentifier, { id })));
				if (names.length) {
					const galleryResult = await this.galleryService.query({ names, pageSize: dependenciesAndPackExtensions.length }, CancellationToken.None);
					for (const galleryExtension of galleryResult.firstPage) {
						if (identifiers.find(identifier => areSameExtensions(identifier, galleryExtension.identifier))) {
							continue;
						}
						const compatibleExtension = await this.checkAndGetCompatibleVersion(galleryExtension);
						const manifest = await this.galleryService.getManifest(compatibleExtension, CancellationToken.None);
						if (manifest === null) {
							throw new ExtensionManagementError(`Missing manifest for extension ${compatibleExtension.identifier.id}`, INSTALL_ERROR_VALIDATING);
						}
						allDependenciesAndPacks.push({ gallery: compatibleExtension, manifest });
						await collectDependenciesAndPackExtensionsToInstall(compatibleExtension.identifier, manifest);
					}
				}
			}
		};

		await collectDependenciesAndPackExtensionsToInstall(extensionIdentifier, manifest);
		installed = await this.getInstalled();
		return allDependenciesAndPacks.filter(e => !installed.some(i => areSameExtensions(i.identifier, e.gallery.identifier)));
	}