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

Move Edit Sessions commands and settings out of experimental namespace #161739

Merged
merged 1 commit into from Sep 26, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostApiCommands.ts
Expand Up @@ -439,7 +439,7 @@ const newCommands: ApiCommand[] = [
),
// --- continue edit session
new ApiCommand(
'vscode.experimental.editSession.continue', '_workbench.experimental.editSessions.actions.continueEditSession', 'Continue the current edit session in a different workspace',
'vscode.experimental.editSession.continue', '_workbench.editSessions.actions.continueEditSession', 'Continue the current edit session in a different workspace',
[ApiCommandArgument.Uri.with('workspaceUri', 'The target workspace to continue the current edit session in')],
ApiCommandResult.Void
)
Expand Down
Expand Up @@ -58,19 +58,19 @@ registerSingleton(IEditSessionsLogService, EditSessionsLogService, false);
registerSingleton(IEditSessionsStorageService, EditSessionsWorkbenchService, false);

const continueWorkingOnCommand: IAction2Options = {
id: '_workbench.experimental.editSessions.actions.continueEditSession',
id: '_workbench.editSessions.actions.continueEditSession',
title: { value: localize('continue working on', "Continue Working On..."), original: 'Continue Working On...' },
precondition: WorkspaceFolderCountContext.notEqualsTo('0'),
f1: true
};
const openLocalFolderCommand: IAction2Options = {
id: '_workbench.experimental.editSessions.actions.continueEditSession.openLocalFolder',
id: '_workbench.editSessions.actions.continueEditSession.openLocalFolder',
title: { value: localize('continue edit session in local folder', "Open In Local Folder"), original: 'Open In Local Folder' },
category: EDIT_SESSION_SYNC_CATEGORY,
precondition: IsWebContext
};
const showOutputChannelCommand: IAction2Options = {
id: 'workbench.experimental.editSessions.actions.showOutputChannel',
id: 'workbench.editSessions.actions.showOutputChannel',
title: { value: localize('show log', 'Show Log'), original: 'Show Log' },
category: EDIT_SESSION_SYNC_CATEGORY
};
Expand All @@ -80,12 +80,10 @@ const resumingProgressOptions = {
title: `[${localize('resuming edit session window', 'Resuming edit session...')}](command:${showOutputChannelCommand.id})`
};
const queryParamName = 'editSessionId';
const experimentalSettingName = 'workbench.experimental.editSessions.enabled';

const useEditSessionsWithContinueOn = 'workbench.experimental.editSessions.continueOn';
const useEditSessionsWithContinueOn = 'workbench.editSessions.continueOn';
export class EditSessionsContribution extends Disposable implements IWorkbenchContribution {

private registered = false;
private continueEditSessionOptions: ContinueEditSessionItem[] = [];

private readonly shouldShowViewsContext: IContextKey<boolean>;
Expand Down Expand Up @@ -116,12 +114,6 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo

this.autoResumeEditSession();

this.configurationService.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration(experimentalSettingName)) {
this.registerActions();
}
});

this.registerActions();
this.registerViews();
this.registerContributedEditSessionOptions();
Expand All @@ -145,8 +137,7 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
if (this.environmentService.editSessionId !== undefined) {
await this.resumeEditSession(this.environmentService.editSessionId).finally(() => this.environmentService.editSessionId = undefined);
} else if (
this.configurationService.getValue('workbench.experimental.editSessions.enabled') === true &&
this.configurationService.getValue('workbench.experimental.editSessions.autoResume') === 'onReload' &&
this.configurationService.getValue('workbench.editSessions.autoResume') === 'onReload' &&
this.editSessionsStorageService.isSignedIn
) {
// Attempt to resume edit session based on edit workspace identifier
Expand Down Expand Up @@ -186,11 +177,6 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
}

private registerActions() {
if (this.registered || this.configurationService.getValue(experimentalSettingName) !== true) {
this.logService.info(`Skipping registering edit sessions actions as edit sessions are currently disabled. Set ${experimentalSettingName} to enable edit sessions.`);
return;
}

this.registerContinueEditSessionAction();

this.registerResumeLatestEditSessionAction();
Expand All @@ -200,8 +186,6 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo

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

this.registered = true;
}

private registerShowEditSessionOutputChannelAction() {
Expand Down Expand Up @@ -289,7 +273,7 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
this._register(registerAction2(class ResumeLatestEditSessionAction extends Action2 {
constructor() {
super({
id: 'workbench.experimental.editSessions.actions.resumeLatest',
id: 'workbench.editSessions.actions.resumeLatest',
title: { value: localize('resume latest.v2', "Resume Latest Edit Session"), original: 'Resume Latest Edit Session' },
category: EDIT_SESSION_SYNC_CATEGORY,
f1: true,
Expand All @@ -315,7 +299,7 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
this._register(registerAction2(class StoreLatestEditSessionAction extends Action2 {
constructor() {
super({
id: 'workbench.experimental.editSessions.actions.storeCurrent',
id: 'workbench.editSessions.actions.storeCurrent',
title: { value: localize('store current.v2', "Store Current Edit Session"), original: 'Store Current Edit Session' },
category: EDIT_SESSION_SYNC_CATEGORY,
f1: true,
Expand Down Expand Up @@ -741,23 +725,28 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
'default': 'off',
'markdownDescription': localize('autoStore', "Controls whether to automatically store an available edit session for the current workspace."),
},
'workbench.experimental.editSessions.enabled': {
'type': 'boolean',
'tags': ['experimental', 'usesOnlineServices'],
'default': true,
'markdownDescription': localize('editSessionsEnabled', "Controls whether to display cloud-enabled actions to store and resume uncommitted changes when switching between web, desktop, or devices."),
},
'workbench.experimental.editSessions.autoResume': {
'workbench.editSessions.autoResume': {
enum: ['onReload', 'off'],
enumDescriptions: [
localize('autoResume.onReload', "Automatically resume available edit session on window reload."),
localize('autoResume.off', "Never attempt to resume an edit session.")
],
'type': 'string',
'tags': ['experimental', 'usesOnlineServices'],
'tags': ['usesOnlineServices'],
'default': 'onReload',
'markdownDescription': localize('autoResume', "Controls whether to automatically resume an available edit session for the current workspace."),
},
'workbench.editSessions.continueOn': {
enum: ['prompt', 'off'],
enumDescriptions: [
localize('continueOn.promptForAuth', 'Prompt the user to sign in to store edit sessions with Continue Working On.'),
localize('continueOn.off', 'Do not use edit sessions with Continue Working On unless the user has already turned on edit sessions.')
],
type: 'string',
tags: ['usesOnlineServices'],
default: 'prompt',
markdownDescription: localize('continueOn', 'Controls whether to prompt the user to store edit sessions when using Continue Working On.')
},
'workbench.experimental.editSessions.continueOn': {
enum: ['prompt', 'off'],
enumDescriptions: [
Expand All @@ -767,7 +756,25 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
type: 'string',
tags: ['experimental', 'usesOnlineServices'],
default: 'prompt',
markdownDeprecationMessage: localize('continueOnDeprecated', 'This setting is deprecated in favor of {0}.', '`#workbench.experimental.continueOn#`'),
markdownDescription: localize('continueOn', 'Controls whether to prompt the user to store edit sessions when using Continue Working On.')
}
},
'workbench.experimental.editSessions.enabled': {
'type': 'boolean',
'tags': ['experimental', 'usesOnlineServices'],
'default': true,
'markdownDeprecationMessage': localize('editSessionsEnabledDeprecated', "This setting is deprecated as Edit Sessions are no longer experimental. Please see {0} and {1} for configuring behavior related to Edit Sessions.", '`#workbench.editSessions.autoResume#`', '`#workbench.editSessions.continueOn#`')
},
'workbench.experimental.editSessions.autoResume': {
enum: ['onReload', 'off'],
enumDescriptions: [
localize('autoResume.onReload', "Automatically resume available edit session on window reload."),
localize('autoResume.off', "Never attempt to resume an edit session.")
],
'type': 'string',
'tags': ['experimental', 'usesOnlineServices'],
'default': 'onReload',
'markdownDeprecationMessage': localize('autoResumeDeprecated', "This setting is deprecated in favor of {0}.", '`#workbench.editSessions.autoResume#`')
},
}
});
Expand Up @@ -293,7 +293,7 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes

quickpick.onDidTriggerItemButton(async (e) => {
if (e.button.tooltip === configureContinueOnPreference.tooltip) {
await this.commandService.executeCommand('workbench.action.openSettings', 'workbench.experimental.editSessions.continueOn');
await this.commandService.executeCommand('workbench.action.openSettings', 'workbench.editSessions.continueOn');
}
});

Expand Down
Expand Up @@ -90,7 +90,7 @@ export class EditSessionsDataViews extends Disposable {
async run(accessor: ServicesAccessor, handle: TreeViewItemHandleArg): Promise<void> {
const editSessionId = URI.parse(handle.$treeItemHandle).path.substring(1);
const commandService = accessor.get(ICommandService);
await commandService.executeCommand('workbench.experimental.editSessions.actions.resumeLatest', editSessionId);
await commandService.executeCommand('workbench.editSessions.actions.resumeLatest', editSessionId);
await treeView.refresh();
}
});
Expand All @@ -106,7 +106,7 @@ export class EditSessionsDataViews extends Disposable {

async run(accessor: ServicesAccessor, handle: TreeViewItemHandleArg): Promise<void> {
const commandService = accessor.get(ICommandService);
await commandService.executeCommand('workbench.experimental.editSessions.actions.storeCurrent');
await commandService.executeCommand('workbench.editSessions.actions.storeCurrent');
await treeView.refresh();
}
});
Expand Down