src/vs/workbench/api/common/extHostExtensionActivator.ts/ExtensionsActivator/_activateExtensions
class ExtensionsActivator:	private _activateExtensions(extensions: ActivationIdAndReason[]): Promise<void> {
		if (extensions.length === 0) {
			return Promise.resolve(undefined);
		}

		extensions = extensions.filter((p) => !this._activatedExtensions.has(ExtensionIdentifier.toKey(p.id)));
		if (extensions.length === 0) {
			return Promise.resolve(undefined);
		}

		const greenMap: { [id: string]: ActivationIdAndReason; } = Object.create(null),
			red: ActivationIdAndReason[] = [];

		for (let i = 0, len = extensions.length; i < len; i++) {
			this._handleActivateRequest(extensions[i], greenMap, red);
		}

		// Make sure no red is also green
		for (let i = 0, len = red.length; i < len; i++) {
			const redExtensionKey = ExtensionIdentifier.toKey(red[i].id);
			if (greenMap[redExtensionKey]) {
				delete greenMap[redExtensionKey];
			}
		}

		const green = Object.keys(greenMap).map(id => greenMap[id]);

		if (red.length === 0) {
			// Finally reached only leafs!
			return Promise.all(green.map((p) => this._activateExtension(p.id, p.reason))).then(_ => undefined);
		}

		return this._activateExtensions(green).then(_ => {
			return this._activateExtensions(red);
		});
	}