src/vs/code/electron-browser/sharedProcess/contrib/extensionsCleaner.ts/ProfileExtensionsCleaner/onDidChangeProfiles
class ProfileExtensionsCleaner:	private async onDidChangeProfiles({ added, removed, all }: DidChangeProfilesEvent): Promise<void> {
		try {
			await Promise.all(removed.map(profile => profile.extensionsResource ? this.removeExtensionsFromProfile(profile.extensionsResource) : Promise.resolve()));
		} catch (error) {
			this.logService.error(error);
		}

		if (all.length === 0) {
			// Exit profile mode
			this.profileModeDisposables.clear();
			// Listen for entering into profile mode
			const disposable = this._register(this.userDataProfilesService.onDidChangeProfiles(() => {
				disposable.dispose();
				this.onDidChangeProfiles({ added: this.userDataProfilesService.profiles, removed: [], all: this.userDataProfilesService.profiles });
			}));
			return;
		}

		try {
			if (added.length) {
				await Promise.all(added.map(profile => profile.extensionsResource ? this.populateExtensionsFromProfile(profile.extensionsResource) : Promise.resolve()));
				// Enter profile mode
				if (!this.profileModeDisposables.value) {
					this.profileModeDisposables.value = new DisposableStore();
					this.profileModeDisposables.value.add(toDisposable(() => this.profileExtensionsLocations.clear()));
					this.profileModeDisposables.value.add(this.userDataProfilesService.onDidChangeProfiles(e => this.onDidChangeProfiles(e)));
					this.profileModeDisposables.value.add(this.extensionManagementService.onDidInstallExtensions(e => this.onDidInstallExtensions(e)));
					this.profileModeDisposables.value.add(this.extensionManagementService.onDidUninstallExtension(e => this.onDidUninstallExtension(e)));
					await this.uninstallExtensionsNotInProfiles();
				}
			}
		} catch (error) {
			this.logService.error(error);
		}
	}