Skip to content

Commit 6e7b7a3

Browse files
authored
Add hyperlink to edit sessions output channel (microsoft#158987)
1 parent ea09b02 commit 6e7b7a3

File tree

1 file changed

+44
-25
lines changed

1 file changed

+44
-25
lines changed

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

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation';
5151
import { equals } from 'vs/base/common/objects';
5252
import { IEditSessionIdentityService } from 'vs/platform/workspace/common/editSessions';
5353
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
54+
import { IOutputService } from 'vs/workbench/services/output/common/output';
55+
import * as Constants from 'vs/workbench/contrib/logs/common/logConstants';
5456

5557
registerSingleton(IEditSessionsLogService, EditSessionsLogService);
5658
registerSingleton(IEditSessionsStorageService, EditSessionsWorkbenchService);
@@ -68,6 +70,16 @@ const openLocalFolderCommand: IAction2Options = {
6870
category: EDIT_SESSION_SYNC_CATEGORY,
6971
precondition: IsWebContext
7072
};
73+
const showOutputChannelCommand: IAction2Options = {
74+
id: 'workbench.experimental.editSessions.actions.showOutputChannel',
75+
title: { value: localize('show log', 'Show Log'), original: 'Show Log' },
76+
category: EDIT_SESSION_SYNC_CATEGORY
77+
};
78+
const resumingProgressOptions = {
79+
location: ProgressLocation.Window,
80+
type: 'syncing',
81+
title: `[${localize('resuming edit session window', 'Resuming edit session...')}](command:${showOutputChannelCommand.id})`
82+
};
7183
const queryParamName = 'editSessionId';
7284
const experimentalSettingName = 'workbench.experimental.editSessions.enabled';
7385

@@ -120,31 +132,27 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
120132
this.lifecycleService.onWillShutdown((e) => e.join(this.autoStoreEditSession(), { id: 'autoStoreEditSession', label: localize('autoStoreEditSession', 'Storing current edit session...') }));
121133
}
122134

123-
private async autoResumeEditSession() {
124-
if (this.environmentService.editSessionId !== undefined) {
125-
// In web, resume edit session based on an edit session GUID that
126-
// was explicitly passed into the workbench construction options
127-
void this.progressService.withProgress({ location: ProgressLocation.Window, type: 'syncing', title: localize('resuming edit session dialog', 'Resuming your latest edit session...') }, async () => {
128-
performance.mark('code/willResumeEditSessionFromIdentifier');
135+
private autoResumeEditSession() {
136+
void this.progressService.withProgress(resumingProgressOptions, async () => {
137+
performance.mark('code/willResumeEditSessionFromIdentifier');
129138

130-
type ResumeEvent = {};
131-
type ResumeClassification = {
132-
owner: 'joyceerhl'; comment: 'Reporting when an action is resumed from an edit session identifier.';
133-
};
134-
this.telemetryService.publicLog2<ResumeEvent, ResumeClassification>('editSessions.continue.resume');
139+
type ResumeEvent = {};
140+
type ResumeClassification = {
141+
owner: 'joyceerhl'; comment: 'Reporting when an action is resumed from an edit session identifier.';
142+
};
143+
this.telemetryService.publicLog2<ResumeEvent, ResumeClassification>('editSessions.continue.resume');
135144

145+
if (this.environmentService.editSessionId !== undefined) {
136146
await this.resumeEditSession(this.environmentService.editSessionId).finally(() => this.environmentService.editSessionId = undefined);
137-
138-
performance.mark('code/didResumeEditSessionFromIdentifier');
139-
});
140-
} else if (this.configurationService.getValue('workbench.experimental.editSessions.autoResume') === 'onReload' && this.editSessionsStorageService.isSignedIn) {
141-
// Attempt to resume edit session based on edit workspace identifier
142-
// Note: at this point if the user is not signed into edit sessions,
143-
// we don't want them to be prompted to sign in and should just return early
144-
void this.progressService.withProgress({ location: ProgressLocation.Window, type: 'syncing', title: localize('resuming edit session window', 'Resuming edit session...') }, async () => {
147+
} else if (this.configurationService.getValue('workbench.experimental.editSessions.autoResume') === 'onReload' && this.editSessionsStorageService.isSignedIn) {
148+
// Attempt to resume edit session based on edit workspace identifier
149+
// Note: at this point if the user is not signed into edit sessions,
150+
// we don't want them to be prompted to sign in and should just return early
145151
await this.resumeEditSession(undefined, true);
146-
});
147-
}
152+
}
153+
154+
performance.mark('code/didResumeEditSessionFromIdentifier');
155+
});
148156
}
149157

150158
private async autoStoreEditSession() {
@@ -187,10 +195,24 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
187195
this.registerContinueInLocalFolderAction();
188196

189197
this.registerShowEditSessionViewAction();
198+
this.registerShowEditSessionOutputChannelAction();
190199

191200
this.registered = true;
192201
}
193202

203+
private registerShowEditSessionOutputChannelAction() {
204+
this._register(registerAction2(class ShowEditSessionOutput extends Action2 {
205+
constructor() {
206+
super(showOutputChannelCommand);
207+
}
208+
209+
run(accessor: ServicesAccessor, ...args: any[]) {
210+
const outputChannel = accessor.get(IOutputService);
211+
void outputChannel.showChannel(Constants.editSessionsLogChannelId);
212+
}
213+
}));
214+
}
215+
194216
private registerShowEditSessionViewAction() {
195217
const that = this;
196218
this._register(registerAction2(class ShowEditSessionView extends Action2 {
@@ -262,10 +284,7 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
262284
}
263285

264286
async run(accessor: ServicesAccessor, editSessionId?: string): Promise<void> {
265-
await that.progressService.withProgress({
266-
location: ProgressLocation.Notification,
267-
title: localize('resuming edit session', 'Resuming edit session...')
268-
}, async () => {
287+
await that.progressService.withProgress(resumingProgressOptions, async () => {
269288
type ResumeEvent = {};
270289
type ResumeClassification = {
271290
owner: 'joyceerhl'; comment: 'Reporting when the resume edit session action is invoked.';

0 commit comments

Comments
 (0)