Skip to content

Commit 5cecbf4

Browse files
authored
Revert "Increment global activity badge if edit sessions aren't turned on" (microsoft#160537)
This reverts commit ea9a778.
1 parent 8268e5d commit 5cecbf4

File tree

2 files changed

+9
-51
lines changed

2 files changed

+9
-51
lines changed

src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,15 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
296296
});
297297
}
298298

299-
async run(accessor: ServicesAccessor, editSessionId?: string, silent?: boolean): Promise<void> {
299+
async run(accessor: ServicesAccessor, editSessionId?: string): Promise<void> {
300300
await that.progressService.withProgress(resumingProgressOptions, async () => {
301301
type ResumeEvent = {};
302302
type ResumeClassification = {
303303
owner: 'joyceerhl'; comment: 'Reporting when the resume edit session action is invoked.';
304304
};
305305
that.telemetryService.publicLog2<ResumeEvent, ResumeClassification>('editSessions.resume');
306306

307-
await that.resumeEditSession(editSessionId, silent);
307+
await that.resumeEditSession(editSessionId);
308308
});
309309
}
310310
}));

src/vs/workbench/contrib/editSessions/browser/editSessionsStorageService.ts

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { Disposable, MutableDisposable } from 'vs/base/common/lifecycle';
6+
import { Disposable } from 'vs/base/common/lifecycle';
77
import { URI } from 'vs/base/common/uri';
88
import { localize } from 'vs/nls';
99
import { Action2, MenuId, registerAction2 } from 'vs/platform/actions/common/actions';
@@ -26,15 +26,11 @@ import { getCurrentAuthenticationSessionInfo } from 'vs/workbench/services/authe
2626
import { isWeb } from 'vs/base/common/platform';
2727
import { ICommandService } from 'vs/platform/commands/common/commands';
2828
import { Codicon } from 'vs/base/common/codicons';
29-
import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/common/activity';
30-
import { WorkspaceFolderCountContext } from 'vs/workbench/common/contextkeys';
3129

3230
type ExistingSession = IQuickPickItem & { session: AuthenticationSession & { providerId: string } };
3331
type AuthenticationProviderOption = IQuickPickItem & { provider: IAuthenticationProvider };
3432

3533
const configureContinueOnPreference = { iconClass: Codicon.settingsGear.classNames, tooltip: localize('configure continue on', 'Configure this preference in settings') };
36-
const turnOnEditSessionsTitle = localize('sign in', 'Turn on Edit Sessions...');
37-
3834
export class EditSessionsWorkbenchService extends Disposable implements IEditSessionsStorageService {
3935

4036
_serviceBrand = undefined;
@@ -52,8 +48,6 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
5248
return this.existingSessionId !== undefined;
5349
}
5450

55-
private globalActivityBadgeDisposable = this._register(new MutableDisposable());
56-
5751
constructor(
5852
@IFileService private readonly fileService: IFileService,
5953
@IStorageService private readonly storageService: IStorageService,
@@ -67,8 +61,7 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
6761
@IRequestService private readonly requestService: IRequestService,
6862
@IDialogService private readonly dialogService: IDialogService,
6963
@ICredentialsService private readonly credentialsService: ICredentialsService,
70-
@ICommandService private readonly commandService: ICommandService,
71-
@IActivityService private readonly activityService: IActivityService,
64+
@ICommandService private readonly commandService: ICommandService
7265
) {
7366
super();
7467

@@ -78,13 +71,11 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
7871
// If another window changes the preferred session storage, reset our cached auth state in memory
7972
this._register(this.storageService.onDidChangeValue(e => this.onDidChangeStorage(e)));
8073

81-
this.registerTurnOnAction();
74+
this.registerSignInAction();
8275
this.registerResetAuthenticationAction();
8376

8477
this.signedInContext = EDIT_SESSIONS_SIGNED_IN.bindTo(this.contextKeyService);
8578
this.signedInContext.set(this.existingSessionId !== undefined);
86-
87-
this.updateGlobalActivityBadge();
8879
}
8980

9081
/**
@@ -165,7 +156,6 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
165156
}
166157
this.initialized = await this.doInitialize(fromContinueOn);
167158
this.signedInContext.set(this.initialized);
168-
this.updateGlobalActivityBadge();
169159
return this.initialized;
170160

171161
}
@@ -408,14 +398,13 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
408398
}
409399
}
410400

411-
private registerTurnOnAction() {
401+
private registerSignInAction() {
412402
const that = this;
413-
const when = ContextKeyExpr.equals(EDIT_SESSIONS_SIGNED_IN_KEY, false);
414-
this._register(registerAction2(class TurnOnEditSessionsAction extends Action2 {
403+
this._register(registerAction2(class ResetEditSessionAuthenticationAction extends Action2 {
415404
constructor() {
416405
super({
417406
id: 'workbench.editSessions.actions.signIn',
418-
title: turnOnEditSessionsTitle,
407+
title: localize('sign in', 'Turn on Edit Sessions...'),
419408
category: EDIT_SESSION_SYNC_CATEGORY,
420409
precondition: ContextKeyExpr.equals(EDIT_SESSIONS_SIGNED_IN_KEY, false),
421410
menu: [{
@@ -424,7 +413,7 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
424413
{
425414
id: MenuId.AccountsContext,
426415
group: '2_editSessions',
427-
when,
416+
when: ContextKeyExpr.equals(EDIT_SESSIONS_SIGNED_IN_KEY, false),
428417
}]
429418
});
430419
}
@@ -433,28 +422,6 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
433422
return await that.initialize(false);
434423
}
435424
}));
436-
437-
this._register(registerAction2(class TurnOnEditSessionsAndResumeAction extends Action2 {
438-
constructor() {
439-
super({
440-
id: 'workbench.editSessions.actions.turnOnAndResume',
441-
title: turnOnEditSessionsTitle,
442-
menu: {
443-
group: '6_editSessions',
444-
id: MenuId.GlobalActivity,
445-
// Do not push for edit sessions when there are no workspace folders open
446-
when: ContextKeyExpr.and(when, WorkspaceFolderCountContext.notEqualsTo(0)),
447-
order: 2
448-
}
449-
});
450-
}
451-
452-
async run() {
453-
if (await that.initialize(false)) {
454-
await that.commandService.executeCommand('workbench.experimental.editSessions.actions.resumeLatest', undefined, true);
455-
}
456-
}
457-
}));
458425
}
459426

460427
private registerResetAuthenticationAction() {
@@ -493,13 +460,4 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
493460
}
494461
}));
495462
}
496-
497-
private updateGlobalActivityBadge() {
498-
if (this.initialized) {
499-
return this.globalActivityBadgeDisposable.clear();
500-
}
501-
502-
const badge = new NumberBadge(1, () => turnOnEditSessionsTitle);
503-
this.globalActivityBadgeDisposable.value = this.activityService.showGlobalActivity({ badge, priority: 1 });
504-
}
505463
}

0 commit comments

Comments
 (0)