Skip to content

Commit

Permalink
Command to show sync log
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Jan 14, 2020
1 parent 56a9ef1 commit 441a586
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { UserDataAutoSync } from 'vs/workbench/contrib/userDataSync/browser/userDataAutoSync';
import { UserDataSyncTrigger } from 'vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger';
import { timeout } from 'vs/base/common/async';
import { IOutputService } from 'vs/workbench/contrib/output/common/output';
import * as Constants from 'vs/workbench/contrib/logs/common/logConstants';

const CONTEXT_AUTH_TOKEN_STATE = new RawContextKey<string>('authTokenStatus', AuthTokenStatus.Initializing);
const SYNC_PUSH_LIGHT_ICON_URI = URI.parse(registerAndGetAmdImageURL(`vs/workbench/contrib/userDataSync/browser/media/check-light.svg`));
Expand Down Expand Up @@ -63,6 +65,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
@IDialogService private readonly dialogService: IDialogService,
@IQuickInputService private readonly quickInputService: IQuickInputService,
@IInstantiationService instantiationService: IInstantiationService,
@IOutputService private readonly outputService: IOutputService,
) {
super();
this.userDataSyncStore = getUserDataSyncStore(configurationService);
Expand Down Expand Up @@ -425,6 +428,10 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
return null;
}

private showSyncLog(): Promise<void> {
return this.outputService.showChannel(Constants.userDataSyncLogChannelId);
}

private registerActions(): void {

const turnOnSyncCommandId = 'workbench.userData.actions.syncStart';
Expand Down Expand Up @@ -570,5 +577,15 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
},
when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), ContextKeyExpr.has(`config.${UserDataSyncWorkbenchContribution.ENABLEMENT_SETTING}`)),
});

const showSyncLogCommandId = 'workbench.userData.actions.showSyncLog';
CommandsRegistry.registerCommand(showSyncLogCommandId, () => this.showSyncLog());
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: showSyncLogCommandId,
title: localize('show sync log', "Sync: Show Sync Log")
},
when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized)),
});
}
}

0 comments on commit 441a586

Please sign in to comment.