src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts/UserDataSyncWorkbenchService/turnOn
class UserDataSyncWorkbenchService:	async turnOn(): Promise<void> {
		if (!this.authenticationProviders.length) {
			throw new Error(localize('no authentication providers', "Settings sync cannot be turned on because there are no authentication providers available."));
		}
		if (this.userDataAutoSyncEnablementService.isEnabled()) {
			return;
		}
		if (this.userDataSyncService.status !== SyncStatus.Idle) {
			throw new Error('Cannont turn on sync while syncing');
		}

		const picked = await this.pick();
		if (!picked) {
			throw canceled();
		}

		// User did not pick an account or login failed
		if (this.accountStatus !== AccountStatus.Available) {
			throw new Error(localize('no account', "No account available"));
		}

		const syncTitle = SYNC_TITLE;
		const title = `${syncTitle} [(${localize('show log', "show log")})](command:${SHOW_SYNC_LOG_COMMAND_ID})`;
		const manualSyncTask = await this.userDataSyncService.createManualSyncTask();
		const disposable = isWeb
			? Disposable.None /* In web long running shutdown handlers will not work */
			: this.lifecycleService.onBeforeShutdown(e => e.veto(this.onBeforeShutdown(manualSyncTask), 'veto.settingsSync'));

		try {
			await this.syncBeforeTurningOn(title, manualSyncTask);
		} finally {
			disposable.dispose();
		}

		await this.userDataAutoSyncService.turnOn();

		if (this.userDataSyncStoreManagementService.userDataSyncStore?.canSwitch) {
			await this.synchroniseUserDataSyncStoreType();
		}

		this.notificationService.info(localize('sync turned on', "{0} is turned on", title));
	}