Skip to content

Commit a42d89c

Browse files
authored
1 parent 66fdf79 commit a42d89c

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
865865

866866
private registerManageSyncAction(): void {
867867
const that = this;
868-
const when = ContextKeyExpr.and(CONTEXT_SYNC_ENABLEMENT, CONTEXT_ACCOUNT_STATE.isEqualTo(AccountStatus.Available), CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized));
868+
const when = ContextKeyExpr.and(CONTEXT_SYNC_ENABLEMENT, CONTEXT_ACCOUNT_STATE.notEqualsTo(AccountStatus.Unavailable), CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized));
869869
this._register(registerAction2(class SyncStatusAction extends Action2 {
870870
constructor() {
871871
super({

src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
7575
private _authenticationProviders: IAuthenticationProvider[] = [];
7676
get authenticationProviders() { return this._authenticationProviders; }
7777

78-
private _accountStatus: AccountStatus = AccountStatus.Unavailable;
78+
private _accountStatus: AccountStatus = AccountStatus.Uninitialized;
7979
get accountStatus(): AccountStatus { return this._accountStatus; }
8080
private readonly _onDidChangeAccountStatus = this._register(new Emitter<AccountStatus>());
8181
readonly onDidChangeAccountStatus = this._onDidChangeAccountStatus.event;
@@ -144,10 +144,9 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
144144
}
145145

146146
private updateAuthenticationProviders(): boolean {
147-
this.logService.info('Settings Sync: Updating authentication providers. Authentication Providers from store:', this.userDataSyncStoreManagementService.userDataSyncStore?.authenticationProviders || [].map(({ id }) => id));
148147
const oldValue = this._authenticationProviders;
149148
this._authenticationProviders = (this.userDataSyncStoreManagementService.userDataSyncStore?.authenticationProviders || []).filter(({ id }) => this.authenticationService.declaredProviders.some(provider => provider.id === id));
150-
this.logService.info('Settings Sync: Authentication providers updated', this._authenticationProviders.map(({ id }) => id));
149+
this.logService.trace('Settings Sync: Authentication providers updated', this._authenticationProviders.map(({ id }) => id));
151150
return equals(oldValue, this._authenticationProviders, (a, b) => a.id === b.id);
152151
}
153152

@@ -189,6 +188,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
189188
const initPromise = this.update('initialize');
190189
this._register(this.authenticationService.onDidChangeDeclaredProviders(() => {
191190
if (this.updateAuthenticationProviders()) {
191+
// Trigger update only after the initialization is done
192192
initPromise.finally(() => this.update('declared authentication providers changed'));
193193
}
194194
}));
@@ -223,7 +223,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
223223
}
224224

225225
private async update(reason: string): Promise<void> {
226-
this.logService.info(`Settings Sync: Updating due to ${reason}`);
226+
this.logService.trace(`Settings Sync: Updating due to ${reason}`);
227227

228228
this.updateAuthenticationProviders();
229229
await this.updateCurrentAccount();
@@ -237,18 +237,17 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
237237
}
238238

239239
private async updateCurrentAccount(): Promise<void> {
240-
this.logService.info('Settings Sync: Updating the current account');
240+
this.logService.trace('Settings Sync: Updating the current account');
241241
const currentSessionId = this.currentSessionId;
242242
const currentAuthenticationProviderId = this.currentAuthenticationProviderId;
243243
if (currentSessionId) {
244244
const authenticationProviders = currentAuthenticationProviderId ? this.authenticationProviders.filter(({ id }) => id === currentAuthenticationProviderId) : this.authenticationProviders;
245-
this.logService.info('Settings Sync: Updating the current account using current session', currentSessionId, currentAuthenticationProviderId, authenticationProviders.map(({ id }) => id));
246245
for (const { id, scopes } of authenticationProviders) {
247246
const sessions = (await this.authenticationService.getSessions(id, scopes)) || [];
248247
for (const session of sessions) {
249248
if (session.id === currentSessionId) {
250249
this._current = new UserDataSyncAccount(id, session);
251-
this.logService.info('Settings Sync: Updated the current account', this._current.accountName);
250+
this.logService.trace('Settings Sync: Updated the current account', this._current.accountName);
252251
return;
253252
}
254253
}
@@ -261,7 +260,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
261260
let value: { token: string; authenticationProviderId: string } | undefined = undefined;
262261
if (current) {
263262
try {
264-
this.logService.info('Settings Sync: Updating the token for the account', current.accountName);
263+
this.logService.trace('Settings Sync: Updating the token for the account', current.accountName);
265264
const token = current.token;
266265
this.logService.info('Settings Sync: Token updated for the account', current.accountName);
267266
value = { token, authenticationProviderId: current.authenticationProviderId };
@@ -273,7 +272,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
273272
}
274273

275274
private updateAccountStatus(accountStatus: AccountStatus): void {
276-
this.logService.info(`Settings Sync: Updating the account status to ${accountStatus}`);
275+
this.logService.trace(`Settings Sync: Updating the account status to ${accountStatus}`);
277276
if (this._accountStatus !== accountStatus) {
278277
const previous = this._accountStatus;
279278
this.logService.info(`Settings Sync: Account status changed from ${previous} to ${accountStatus}`);

src/vs/workbench/services/userDataSync/common/userDataSync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const SYNC_VIEW_ICON = registerIcon('settings-sync-view-icon', Codicon.sy
8383
// Contexts
8484
export const CONTEXT_SYNC_STATE = new RawContextKey<string>('syncStatus', SyncStatus.Uninitialized);
8585
export const CONTEXT_SYNC_ENABLEMENT = new RawContextKey<boolean>('syncEnabled', false);
86-
export const CONTEXT_ACCOUNT_STATE = new RawContextKey<string>('userDataSyncAccountStatus', AccountStatus.Unavailable);
86+
export const CONTEXT_ACCOUNT_STATE = new RawContextKey<string>('userDataSyncAccountStatus', AccountStatus.Uninitialized);
8787
export const CONTEXT_ENABLE_ACTIVITY_VIEWS = new RawContextKey<boolean>(`enableSyncActivityViews`, false);
8888
export const CONTEXT_ENABLE_SYNC_CONFLICTS_VIEW = new RawContextKey<boolean>(`enableSyncConflictsView`, false);
8989
export const CONTEXT_HAS_CONFLICTS = new RawContextKey<boolean>('hasConflicts', false);

0 commit comments

Comments
 (0)