diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts index 86580968034..a7e9451e48f 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts @@ -81,9 +81,10 @@ const resolveSettingsConflictsCommand = { id: 'workbench.userData.actions.resolv const resolveKeybindingsConflictsCommand = { id: 'workbench.userData.actions.resolveKeybindingsConflicts', title: localize('showKeybindingsConflicts', "Preferences Sync: Show Keybindings Conflicts") }; const resolveSnippetsConflictsCommand = { id: 'workbench.userData.actions.resolveSnippetsConflicts', title: localize('showSnippetsConflicts', "Preferences Sync: Show User Snippets Conflicts") }; const configureSyncCommand = { id: 'workbench.userData.actions.configureSync', title: localize('configure sync', "Preferences Sync: Configure...") }; -const showSyncActivityCommand = { - id: 'workbench.userData.actions.showSyncActivity', - title: localize('show sync log', "Preferences Sync: Show Log"), +const showSyncActivityCommand = { id: 'workbench.userData.actions.showSyncActivity', title: localize('show sync log', "Preferences Sync: Show Log") }; +const syncNowCommand = { + id: 'workbench.userData.actions.syncNow', + title: localize('sync now', "Preferences Sync: Sync Now"), description(userDataSyncService: IUserDataSyncService): string | undefined { if (userDataSyncService.status === SyncStatus.Syncing) { return localize('sync is on with syncing', "syncing"); @@ -894,6 +895,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo private registerSyncStatusAction(): void { const that = this; const when = ContextKeyExpr.and(CONTEXT_SYNC_ENABLEMENT, CONTEXT_ACCOUNT_STATE.isEqualTo(AccountStatus.Available), CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized)); + this.registerSyncNowAction(); this._register(registerAction2(class SyncStatusAction extends Action2 { constructor() { super({ @@ -946,8 +948,9 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo } items.push({ id: configureSyncCommand.id, label: configureSyncCommand.title }); items.push({ id: showSyncSettingsCommand.id, label: showSyncSettingsCommand.title }); - items.push({ id: showSyncActivityCommand.id, label: showSyncActivityCommand.title, description: showSyncActivityCommand.description(that.userDataSyncService) }); + items.push({ id: showSyncActivityCommand.id, label: showSyncActivityCommand.title }); items.push({ type: 'separator' }); + items.push({ id: syncNowCommand.id, label: syncNowCommand.title, description: syncNowCommand.description(that.userDataSyncService) }); if (that.userDataSyncEnablementService.canToggleEnablement()) { const account = that.userDataSyncAccounts.current; items.push({ id: stopSyncCommand.id, label: stopSyncCommand.title, description: account ? `${account.accountName} (${that.authenticationService.getDisplayName(account.authenticationProviderId)})` : undefined }); @@ -969,6 +972,21 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo })); } + private registerSyncNowAction(): void { + const that = this; + this._register(registerAction2(class SyncNowAction extends Action2 { + constructor() { + super({ + id: syncNowCommand.id, + title: syncNowCommand.title, + }); + } + run(): Promise { + return that.userDataSyncService.sync(); + } + })); + } + private registerTurnOffSyncAction(): void { const that = this; this._register(registerAction2(class StopSyncAction extends Action2 {