src/vs/platform/extensionManagement/common/extensionManagementCLIService.ts/ExtensionManagementCLIService/installExtensions
class ExtensionManagementCLIService:	public async installExtensions(extensions: (string | URI)[], builtinExtensionIds: string[], installOptions: InstallOptions, force: boolean, output: CLIOutput = console): Promise<void> {
		const failed: string[] = [];
		const installedExtensionsManifests: IExtensionManifest[] = [];
		if (extensions.length) {
			output.log(this.location ? localize('installingExtensionsOnLocation', "Installing extensions on {0}...", this.location) : localize('installingExtensions', "Installing extensions..."));
		}

		const installed = await this.extensionManagementService.getInstalled(ExtensionType.User);
		const checkIfNotInstalled = (id: string, version?: string): boolean => {
			const installedExtension = installed.find(i => areSameExtensions(i.identifier, { id }));
			if (installedExtension) {
				if (!force && (!version || (version === 'prerelease' && installedExtension.preRelease))) {
					output.log(localize('alreadyInstalled-checkAndUpdate', "Extension '{0}' v{1} is already installed. Use '--force' option to update to latest version or provide '@<version>' to install a specific version, for example: '{2}@1.2.3'.", id, installedExtension.manifest.version, id));
					return false;
				}
				if (version && installedExtension.manifest.version === version) {
					output.log(localize('alreadyInstalled', "Extension '{0}' is already installed.", `${id}@${version}`));
					return false;
				}
			}
			return true;
		};
		const addInstallExtensionInfo = (id: string, version: string | undefined, isBuiltin: boolean) => {
			installExtensionInfos.push({ id, version: version !== 'prerelease' ? version : undefined, installOptions: { ...installOptions, isBuiltin, installPreReleaseVersion: version === 'prerelease' || installOptions.installPreReleaseVersion } });
		};
		const vsixs: URI[] = [];
		const installExtensionInfos: InstallExtensionInfo[] = [];
		for (const extension of extensions) {
			if (extension instanceof URI) {
				vsixs.push(extension);
			} else {
				const [id, version] = getIdAndVersion(extension);
				if (checkIfNotInstalled(id, version)) {
					addInstallExtensionInfo(id, version, false);
				}
			}
		}
		for (const extension of builtinExtensionIds) {
			const [id, version] = getIdAndVersion(extension);
			if (checkIfNotInstalled(id, version)) {
				addInstallExtensionInfo(id, version, true);
			}
		}

		if (vsixs.length) {
			await Promise.all(vsixs.map(async vsix => {
				try {
					const manifest = await this.installVSIX(vsix, { ...installOptions, isBuiltin: false }, force, output);
					if (manifest) {
						installedExtensionsManifests.push(manifest);
					}
				} catch (err) {
					output.error(err.message || err.stack || err);
					failed.push(vsix.toString());
				}
			}));
		}

		if (installExtensionInfos.length) {

			const galleryExtensions = await this.getGalleryExtensions(installExtensionInfos);

			await Promise.all(installExtensionInfos.map(async extensionInfo => {
				const gallery = galleryExtensions.get(extensionInfo.id.toLowerCase());
				if (gallery) {
					try {
						const manifest = await this.installFromGallery(extensionInfo, gallery, installed, force, output);
						if (manifest) {
							installedExtensionsManifests.push(manifest);
						}
					} catch (err) {
						output.error(err.message || err.stack || err);
						failed.push(extensionInfo.id);
					}
				} else {
					output.error(`${notFound(extensionInfo.version ? `${extensionInfo.id}@${extensionInfo.version}` : extensionInfo.id)}\n${useId}`);
					failed.push(extensionInfo.id);
				}
			}));

		}

		if (failed.length) {
			throw new Error(localize('installation failed', "Failed Installing Extensions: {0}", failed.join(', ')));
		}
	}