Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hyperlink to edit sessions output channel #158987

Merged
merged 1 commit into from
Aug 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation';
import { equals } from 'vs/base/common/objects';
import { IEditSessionIdentityService } from 'vs/platform/workspace/common/editSessions';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { IOutputService } from 'vs/workbench/services/output/common/output';
import * as Constants from 'vs/workbench/contrib/logs/common/logConstants';

registerSingleton(IEditSessionsLogService, EditSessionsLogService);
registerSingleton(IEditSessionsStorageService, EditSessionsWorkbenchService);
Expand All @@ -68,6 +70,16 @@ const openLocalFolderCommand: IAction2Options = {
category: EDIT_SESSION_SYNC_CATEGORY,
precondition: IsWebContext
};
const showOutputChannelCommand: IAction2Options = {
id: 'workbench.experimental.editSessions.actions.showOutputChannel',
title: { value: localize('show log', 'Show Log'), original: 'Show Log' },
category: EDIT_SESSION_SYNC_CATEGORY
};
const resumingProgressOptions = {
location: ProgressLocation.Window,
type: 'syncing',
title: `[${localize('resuming edit session window', 'Resuming edit session...')}](command:${showOutputChannelCommand.id})`
};
const queryParamName = 'editSessionId';
const experimentalSettingName = 'workbench.experimental.editSessions.enabled';

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

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

type ResumeEvent = {};
type ResumeClassification = {
owner: 'joyceerhl'; comment: 'Reporting when an action is resumed from an edit session identifier.';
};
this.telemetryService.publicLog2<ResumeEvent, ResumeClassification>('editSessions.continue.resume');
type ResumeEvent = {};
type ResumeClassification = {
owner: 'joyceerhl'; comment: 'Reporting when an action is resumed from an edit session identifier.';
};
this.telemetryService.publicLog2<ResumeEvent, ResumeClassification>('editSessions.continue.resume');

if (this.environmentService.editSessionId !== undefined) {
await this.resumeEditSession(this.environmentService.editSessionId).finally(() => this.environmentService.editSessionId = undefined);

performance.mark('code/didResumeEditSessionFromIdentifier');
});
} else if (this.configurationService.getValue('workbench.experimental.editSessions.autoResume') === 'onReload' && this.editSessionsStorageService.isSignedIn) {
// Attempt to resume edit session based on edit workspace identifier
// Note: at this point if the user is not signed into edit sessions,
// we don't want them to be prompted to sign in and should just return early
void this.progressService.withProgress({ location: ProgressLocation.Window, type: 'syncing', title: localize('resuming edit session window', 'Resuming edit session...') }, async () => {
} else if (this.configurationService.getValue('workbench.experimental.editSessions.autoResume') === 'onReload' && this.editSessionsStorageService.isSignedIn) {
// Attempt to resume edit session based on edit workspace identifier
// Note: at this point if the user is not signed into edit sessions,
// we don't want them to be prompted to sign in and should just return early
await this.resumeEditSession(undefined, true);
});
}
}

performance.mark('code/didResumeEditSessionFromIdentifier');
});
}

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

this.registerShowEditSessionViewAction();
this.registerShowEditSessionOutputChannelAction();

this.registered = true;
}

private registerShowEditSessionOutputChannelAction() {
this._register(registerAction2(class ShowEditSessionOutput extends Action2 {
constructor() {
super(showOutputChannelCommand);
}

run(accessor: ServicesAccessor, ...args: any[]) {
const outputChannel = accessor.get(IOutputService);
void outputChannel.showChannel(Constants.editSessionsLogChannelId);
}
}));
}

private registerShowEditSessionViewAction() {
const that = this;
this._register(registerAction2(class ShowEditSessionView extends Action2 {
Expand Down Expand Up @@ -262,10 +284,7 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
}

async run(accessor: ServicesAccessor, editSessionId?: string): Promise<void> {
await that.progressService.withProgress({
location: ProgressLocation.Notification,
title: localize('resuming edit session', 'Resuming edit session...')
}, async () => {
await that.progressService.withProgress(resumingProgressOptions, async () => {
type ResumeEvent = {};
type ResumeClassification = {
owner: 'joyceerhl'; comment: 'Reporting when the resume edit session action is invoked.';
Expand Down