Merge from vscode e6a45f4242ebddb7aa9a229f85555e8a3bd987e2 (#9253)

* Merge from vscode e6a45f4242ebddb7aa9a229f85555e8a3bd987e2

* skip failing tests

* remove github-authentication extensions

* ignore github compile steps

* ignore github compile steps

* check in compiled files
This commit is contained in:
Anthony Dresser
2020-02-21 12:11:51 -08:00
committed by GitHub
parent c74bac3746
commit 1b78a9b1e0
179 changed files with 3200 additions and 1830 deletions

View File

@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import { Action } from 'vs/base/common/actions';
import { timeout } from 'vs/base/common/async';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { canceled, isPromiseCanceledError } from 'vs/base/common/errors';
import { Event } from 'vs/base/common/event';
@@ -13,7 +12,7 @@ import { isWeb } from 'vs/base/common/platform';
import { isEqual } from 'vs/base/common/resources';
import { URI } from 'vs/base/common/uri';
import type { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { registerEditorContribution, ServicesAccessor } from 'vs/editor/browser/editorExtensions';
import type { IEditorContribution } from 'vs/editor/common/editorCommon';
import type { ITextModel } from 'vs/editor/common/model';
import { AuthenticationSession } from 'vs/editor/common/modes';
@@ -21,8 +20,8 @@ import { IModelService } from 'vs/editor/common/services/modelService';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ITextModelContentProvider, ITextModelService } from 'vs/editor/common/services/resolverService';
import { localize } from 'vs/nls';
import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { MenuId, MenuRegistry, registerAction2, Action2 } from 'vs/platform/actions/common/actions';
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey, ContextKeyRegexExpr } from 'vs/platform/contextkey/common/contextkey';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
@@ -31,7 +30,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { CONTEXT_SYNC_STATE, getSyncSourceFromRemoteContentResource, getUserDataSyncStore, ISyncConfiguration, IUserDataAuthTokenService, IUserDataAutoSyncService, IUserDataSyncService, IUserDataSyncStore, registerConfiguration, SyncSource, SyncStatus, toRemoteContentResource, UserDataSyncError, UserDataSyncErrorCode, USER_DATA_SYNC_SCHEME, IUserDataSyncEnablementService, ResourceKey, getSyncSourceFromPreviewResource, CONTEXT_SYNC_ENABLEMENT } from 'vs/platform/userDataSync/common/userDataSync';
import { CONTEXT_SYNC_STATE, getSyncSourceFromRemoteContentResource, getUserDataSyncStore, ISyncConfiguration, IUserDataAutoSyncService, IUserDataSyncService, IUserDataSyncStore, registerConfiguration, SyncSource, SyncStatus, toRemoteContentResource, UserDataSyncError, UserDataSyncErrorCode, USER_DATA_SYNC_SCHEME, IUserDataSyncEnablementService, ResourceKey, getSyncSourceFromPreviewResource, CONTEXT_SYNC_ENABLEMENT } from 'vs/platform/userDataSync/common/userDataSync';
import { FloatingClickWidget } from 'vs/workbench/browser/parts/editor/editorWidgets';
import { GLOBAL_ACTIVITY_ID } from 'vs/workbench/common/activity';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
@@ -40,11 +39,14 @@ import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import * as Constants from 'vs/workbench/contrib/logs/common/logConstants';
import { IOutputService } from 'vs/workbench/contrib/output/common/output';
import { UserDataSyncTrigger } from 'vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger';
import { IActivityService, IBadge, NumberBadge, ProgressBadge } from 'vs/workbench/services/activity/common/activity';
import { IActivityService, IBadge, NumberBadge } from 'vs/workbench/services/activity/common/activity';
import { IAuthenticationService } from 'vs/workbench/services/authentication/browser/authenticationService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
import { IAuthenticationTokenService } from 'vs/platform/authentication/common/authentication';
import { fromNow } from 'vs/base/common/date';
import { IProductService } from 'vs/platform/product/common/productService';
const enum AuthStatus {
Initializing = 'Initializing',
@@ -75,6 +77,15 @@ type FirstTimeSyncClassification = {
action: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true };
};
const turnOnSyncCommand = { id: 'workbench.userData.actions.syncStart', title: localize('turn on sync with category', "Sync: Turn on Sync") };
const signInCommand = { id: 'workbench.userData.actions.signin', title: localize('sign in', "Sync: Sign in to sync") };
const stopSyncCommand = { id: 'workbench.userData.actions.stopSync', title: localize('stop sync', "Sync: Turn off Sync") };
const resolveSettingsConflictsCommand = { id: 'workbench.userData.actions.resolveSettingsConflicts', title: localize('showConflicts', "Sync: Show Settings Conflicts") };
const resolveKeybindingsConflictsCommand = { id: 'workbench.userData.actions.resolveKeybindingsConflicts', title: localize('showKeybindingsConflicts', "Sync: Show Keybindings Conflicts") };
const configureSyncCommand = { id: 'workbench.userData.actions.configureSync', title: localize('configure sync', "Sync: Configure") };
const showSyncActivityCommand = { id: 'workbench.userData.actions.showSyncActivity', title: localize('show sync log', "Sync: Show Activity") };
const showSyncSettingsCommand = { id: 'workbench.userData.actions.syncSettings', title: localize('sync settings', "Sync: Settings"), };
export class UserDataSyncWorkbenchContribution extends Disposable implements IWorkbenchContribution {
private readonly userDataSyncStore: IUserDataSyncStore | undefined;
@@ -87,6 +98,8 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
private readonly signInNotificationDisposable = this._register(new MutableDisposable());
private _activeAccount: AuthenticationSession | undefined;
private readonly syncStatusAction = this._register(new MutableDisposable());
constructor(
@IUserDataSyncEnablementService private readonly userDataSyncEnablementService: IUserDataSyncEnablementService,
@IUserDataSyncService private readonly userDataSyncService: IUserDataSyncService,
@@ -101,12 +114,13 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
@IQuickInputService private readonly quickInputService: IQuickInputService,
@IInstantiationService instantiationService: IInstantiationService,
@IOutputService private readonly outputService: IOutputService,
@IUserDataAuthTokenService private readonly userDataAuthTokenService: IUserDataAuthTokenService,
@IAuthenticationTokenService private readonly authTokenService: IAuthenticationTokenService,
@IUserDataAutoSyncService userDataAutoSyncService: IUserDataAutoSyncService,
@ITextModelService textModelResolverService: ITextModelService,
@IPreferencesService private readonly preferencesService: IPreferencesService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IFileService private readonly fileService: IFileService,
@IProductService private readonly productService: IProductService,
) {
super();
this.userDataSyncStore = getUserDataSyncStore(configurationService);
@@ -121,12 +135,12 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
this.onDidChangeEnablement(this.userDataSyncEnablementService.isEnabled());
this._register(Event.debounce(userDataSyncService.onDidChangeStatus, () => undefined, 500)(() => this.onDidChangeSyncStatus(this.userDataSyncService.status)));
this._register(userDataSyncService.onDidChangeConflicts(() => this.onDidChangeConflicts(this.userDataSyncService.conflictsSources)));
this._register(this.userDataAuthTokenService.onTokenFailed(_ => this.authenticationService.getSessions(this.userDataSyncStore!.authenticationProviderId)));
this._register(this.authTokenService.onTokenFailed(_ => this.authenticationService.getSessions(this.userDataSyncStore!.authenticationProviderId)));
this._register(this.userDataSyncEnablementService.onDidChangeEnablement(enabled => this.onDidChangeEnablement(enabled)));
this._register(this.authenticationService.onDidRegisterAuthenticationProvider(e => this.onDidRegisterAuthenticationProvider(e)));
this._register(this.authenticationService.onDidUnregisterAuthenticationProvider(e => this.onDidUnregisterAuthenticationProvider(e)));
this._register(this.authenticationService.onDidChangeSessions(e => this.onDidChangeSessions(e)));
this._register(userDataAutoSyncService.onError(({ code, source }) => this.onAutoSyncError(code, source)));
this._register(userDataAutoSyncService.onError(error => this.onAutoSyncError(error)));
this.registerActions();
this.initializeActiveAccount().then(_ => {
if (!isWeb) {
@@ -194,14 +208,14 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
if (account) {
try {
const token = await account.accessToken();
this.userDataAuthTokenService.setToken(token);
this.authTokenService.setToken(token);
this.authenticationState.set(AuthStatus.SignedIn);
} catch (e) {
this.userDataAuthTokenService.setToken(undefined);
this.authTokenService.setToken(undefined);
this.authenticationState.set(AuthStatus.Unavailable);
}
} else {
this.userDataAuthTokenService.setToken(undefined);
this.authTokenService.setToken(undefined);
this.authenticationState.set(AuthStatus.SignedOut);
}
@@ -236,12 +250,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
private onDidChangeSyncStatus(status: SyncStatus) {
this.syncStatusContext.set(status);
if (status === SyncStatus.Syncing) {
// Show syncing progress if takes more than 1s.
timeout(1000).then(() => this.updateBadge());
} else {
this.updateBadge();
}
this.updateBadge();
}
private onDidChangeConflicts(conflicts: SyncSource[]) {
@@ -362,21 +371,38 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
}
}
private onAutoSyncError(code: UserDataSyncErrorCode, source?: SyncSource): void {
switch (code) {
private onAutoSyncError(error: UserDataSyncError): void {
switch (error.code) {
case UserDataSyncErrorCode.TurnedOff:
case UserDataSyncErrorCode.SessionExpired:
this.notificationService.notify({
severity: Severity.Info,
message: localize('turned off', "Turned off sync because it was turned off from other device."),
actions: {
primary: [new Action('turn on sync', localize('Turn on sync', "Turn on Sync"), undefined, true, () => this.turnOn())]
}
});
return;
case UserDataSyncErrorCode.TooLarge:
if (source === SyncSource.Keybindings || source === SyncSource.Settings) {
const sourceArea = getSyncAreaLabel(source);
if (error.source === SyncSource.Keybindings || error.source === SyncSource.Settings) {
const sourceArea = getSyncAreaLabel(error.source);
this.notificationService.notify({
severity: Severity.Error,
message: localize('too large', "Disabled synchronizing {0} because size of the {1} file to sync is larger than {2}. Please open the file and reduce the size and enable sync", sourceArea, sourceArea, '100kb'),
message: localize('too large', "Disabled sync {0} because size of the {1} file to sync is larger than {2}. Please open the file and reduce the size and enable sync", sourceArea, sourceArea, '100kb'),
actions: {
primary: [new Action('open sync file', localize('open file', "Show {0} file", sourceArea), undefined, true,
() => source === SyncSource.Settings ? this.preferencesService.openGlobalSettings(true) : this.preferencesService.openGlobalKeybindingSettings(true))]
() => error.source === SyncSource.Settings ? this.preferencesService.openGlobalSettings(true) : this.preferencesService.openGlobalKeybindingSettings(true))]
}
});
}
return;
case UserDataSyncErrorCode.Incompatible:
this.disableSync();
this.notificationService.notify({
severity: Severity.Error,
message: localize('error incompatible', "Turned off sync because local data is incompatible with the data in the cloud. Please update {0} and turn on sync to continue syncing.", this.productService.nameLong),
});
return;
}
}
@@ -391,10 +417,6 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
badge = new NumberBadge(1, () => localize('sign in to sync', "Sign in to Sync"));
} else if (this.userDataSyncService.conflictsSources.length) {
badge = new NumberBadge(this.userDataSyncService.conflictsSources.length, () => localize('has conflicts', "Sync: Conflicts Detected"));
} else if (this.userDataSyncService.status === SyncStatus.Syncing) {
badge = new ProgressBadge(() => localize('syncing', "Synchronizing User Configuration..."));
clazz = 'progress-badge';
priority = 1;
}
if (badge) {
@@ -441,6 +463,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
}
await this.handleFirstTimeSync();
this.userDataSyncEnablementService.setEnablement(true);
this.notificationService.info(localize('sync turned on', "Sync is turned on and from now on sycing will be done automatically."));
}
private getConfigureSyncQuickPickItems(): ConfigureSyncQuickPickItem[] {
@@ -508,7 +531,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
[
localize('merge', "Merge"),
localize('cancel', "Cancel"),
localize('replace', "Replace (Overwrite Local)"),
localize('replace', "Replace Local"),
],
{
cancelId: 1,
@@ -611,15 +634,78 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
}
}
private showSyncLog(): Promise<void> {
private showSyncActivity(): Promise<void> {
return this.outputService.showChannel(Constants.userDataSyncLogChannelId);
}
private registerActions(): void {
this.registerTurnOnSyncAction();
this.registerTurnOffSyncAction();
const turnOnSyncCommandId = 'workbench.userData.actions.syncStart';
this.registerSyncStatusAction();
this.registerSignInAction();
this.registerShowSettingsConflictsAction();
this.registerShowKeybindingsConflictsAction();
this.registerConfigureSyncAction();
this.registerShowActivityAction();
this.registerShowSettingsAction();
}
private registerSyncStatusAction(): void {
const that = this;
this.syncStatusAction.value = registerAction2(class SyncStatusAction extends Action2 {
constructor() {
super({
id: 'workbench.userData.actions.syncStatus',
get title() {
if (that.userDataSyncService.status === SyncStatus.Syncing) {
return localize('sync is on with syncing', "Sync is on (syncing)");
}
if (that.userDataSyncService.lastSyncTime) {
return localize('sync is on with time', "Sync is on (synced {0})", fromNow(that.userDataSyncService.lastSyncTime, true));
}
return localize('sync is on', "Sync is on");
},
menu: {
id: MenuId.GlobalActivity,
group: '5_sync',
when: ContextKeyExpr.and(CONTEXT_SYNC_ENABLEMENT, CONTEXT_AUTH_TOKEN_STATE.isEqualTo(AuthStatus.SignedIn), CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized))
},
});
}
run(accessor: ServicesAccessor): any {
return new Promise((c, e) => {
const quickInputService = accessor.get(IQuickInputService);
const commandService = accessor.get(ICommandService);
const quickPick = quickInputService.createQuickPick();
quickPick.items = [
{ id: configureSyncCommand.id, label: configureSyncCommand.title },
{ id: showSyncSettingsCommand.id, label: showSyncSettingsCommand.title },
{ id: showSyncActivityCommand.id, label: showSyncActivityCommand.title },
{ type: 'separator' },
{ id: stopSyncCommand.id, label: stopSyncCommand.title }
];
const disposables = new DisposableStore();
disposables.add(quickPick.onDidAccept(() => {
if (quickPick.selectedItems[0] && quickPick.selectedItems[0].id) {
commandService.executeCommand(quickPick.selectedItems[0].id);
}
quickPick.hide();
}));
disposables.add(quickPick.onDidHide(() => {
disposables.dispose();
c();
}));
quickPick.show();
});
}
});
}
private registerTurnOnSyncAction(): void {
const turnOnSyncWhenContext = ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), CONTEXT_SYNC_ENABLEMENT.toNegated(), CONTEXT_AUTH_TOKEN_STATE.notEqualsTo(AuthStatus.Initializing));
CommandsRegistry.registerCommand(turnOnSyncCommandId, async () => {
CommandsRegistry.registerCommand(turnOnSyncCommand.id, async () => {
try {
await this.turnOn();
} catch (e) {
@@ -631,139 +717,161 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
group: '5_sync',
command: {
id: turnOnSyncCommandId,
id: turnOnSyncCommand.id,
title: localize('global activity turn on sync', "Turn on Sync...")
},
when: turnOnSyncWhenContext,
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: turnOnSyncCommandId,
title: localize('turn on sync...', "Sync: Turn on Sync...")
},
command: turnOnSyncCommand,
when: turnOnSyncWhenContext,
});
MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
group: '5_sync',
command: {
id: turnOnSyncCommandId,
id: turnOnSyncCommand.id,
title: localize('global activity turn on sync', "Turn on Sync...")
},
when: turnOnSyncWhenContext,
});
}
const signInCommandId = 'workbench.userData.actions.signin';
const signInWhenContext = ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), CONTEXT_SYNC_ENABLEMENT, CONTEXT_AUTH_TOKEN_STATE.isEqualTo(AuthStatus.SignedOut));
CommandsRegistry.registerCommand(signInCommandId, () => this.signIn());
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
group: '5_sync',
command: {
id: signInCommandId,
title: localize('global activity sign in', "Sign in to Sync... (1)")
},
when: signInWhenContext,
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: signInCommandId,
title: localize('sign in', "Sync: Sign in to sync...")
},
when: signInWhenContext,
});
const stopSyncCommandId = 'workbench.userData.actions.stopSync';
CommandsRegistry.registerCommand(stopSyncCommandId, async () => {
try {
await this.turnOff();
} catch (e) {
if (!isPromiseCanceledError(e)) {
this.notificationService.error(localize('turn off failed', "Error while turning off sync: {0}", toErrorMessage(e)));
private registerTurnOffSyncAction(): void {
const that = this;
registerAction2(class StopSyncAction extends Action2 {
constructor() {
super({
id: stopSyncCommand.id,
title: stopSyncCommand.title,
menu: {
id: MenuId.CommandPalette,
when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), CONTEXT_SYNC_ENABLEMENT),
},
});
}
async run(accessor: ServicesAccessor): Promise<any> {
try {
await that.turnOff();
} catch (e) {
if (!isPromiseCanceledError(e)) {
that.notificationService.error(localize('turn off failed', "Error while turning off sync: {0}", toErrorMessage(e)));
}
}
}
});
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
group: '5_sync',
command: {
id: stopSyncCommandId,
title: localize('global activity stop sync', "Turn off Sync")
},
when: ContextKeyExpr.and(CONTEXT_SYNC_ENABLEMENT, CONTEXT_AUTH_TOKEN_STATE.isEqualTo(AuthStatus.SignedIn), CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.HasConflicts))
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: stopSyncCommandId,
title: localize('stop sync', "Sync: Turn off Sync")
},
when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), CONTEXT_SYNC_ENABLEMENT),
});
MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
group: '5_sync',
command: {
id: stopSyncCommandId,
title: localize('global activity stop sync', "Turn off Sync")
},
when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), CONTEXT_SYNC_ENABLEMENT),
});
}
const resolveSettingsConflictsCommandId = 'workbench.userData.actions.resolveSettingsConflicts';
private registerSignInAction(): void {
const that = this;
registerAction2(class StopSyncAction extends Action2 {
constructor() {
super({
id: signInCommand.id,
title: signInCommand.title,
menu: {
group: '5_sync',
id: MenuId.GlobalActivity,
when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), CONTEXT_SYNC_ENABLEMENT, CONTEXT_AUTH_TOKEN_STATE.isEqualTo(AuthStatus.SignedOut)),
},
});
}
async run(): Promise<any> {
try {
await that.signIn();
} catch (e) {
that.notificationService.error(e);
}
}
});
}
private registerShowSettingsConflictsAction(): void {
const resolveSettingsConflictsWhenContext = ContextKeyRegexExpr.create(CONTEXT_CONFLICTS_SOURCES.keys()[0], /.*settings.*/i);
CommandsRegistry.registerCommand(resolveSettingsConflictsCommandId, () => this.handleConflicts(SyncSource.Settings));
CommandsRegistry.registerCommand(resolveSettingsConflictsCommand.id, () => this.handleConflicts(SyncSource.Settings));
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
group: '5_sync',
command: {
id: resolveSettingsConflictsCommandId,
id: resolveSettingsConflictsCommand.id,
title: localize('resolveConflicts_global', "Sync: Show Settings Conflicts (1)"),
},
when: resolveSettingsConflictsWhenContext,
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: resolveSettingsConflictsCommandId,
title: localize('showConflicts', "Sync: Show Settings Conflicts"),
},
command: resolveSettingsConflictsCommand,
when: resolveSettingsConflictsWhenContext,
});
}
const resolveKeybindingsConflictsCommandId = 'workbench.userData.actions.resolveKeybindingsConflicts';
private registerShowKeybindingsConflictsAction(): void {
const resolveKeybindingsConflictsWhenContext = ContextKeyRegexExpr.create(CONTEXT_CONFLICTS_SOURCES.keys()[0], /.*keybindings.*/i);
CommandsRegistry.registerCommand(resolveKeybindingsConflictsCommandId, () => this.handleConflicts(SyncSource.Keybindings));
CommandsRegistry.registerCommand(resolveKeybindingsConflictsCommand.id, () => this.handleConflicts(SyncSource.Keybindings));
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
group: '5_sync',
command: {
id: resolveKeybindingsConflictsCommandId,
id: resolveKeybindingsConflictsCommand.id,
title: localize('resolveKeybindingsConflicts_global', "Sync: Show Keybindings Conflicts (1)"),
},
when: resolveKeybindingsConflictsWhenContext,
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: resolveKeybindingsConflictsCommandId,
title: localize('showKeybindingsConflicts', "Sync: Show Keybindings Conflicts"),
},
command: resolveKeybindingsConflictsCommand,
when: resolveKeybindingsConflictsWhenContext,
});
const configureSyncCommandId = 'workbench.userData.actions.configureSync';
CommandsRegistry.registerCommand(configureSyncCommandId, () => this.configureSyncOptions());
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: configureSyncCommandId,
title: localize('configure sync', "Sync: Configure")
},
when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), CONTEXT_SYNC_ENABLEMENT),
});
const showSyncLogCommandId = 'workbench.userData.actions.showSyncLog';
CommandsRegistry.registerCommand(showSyncLogCommandId, () => this.showSyncLog());
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: showSyncLogCommandId,
title: localize('show sync log', "Sync: Show Sync Log")
},
when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized)),
});
}
private registerConfigureSyncAction(): void {
const that = this;
registerAction2(class ShowSyncActivityAction extends Action2 {
constructor() {
super({
id: configureSyncCommand.id,
title: configureSyncCommand.title,
menu: {
id: MenuId.CommandPalette,
when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), CONTEXT_SYNC_ENABLEMENT),
},
});
}
run(): any { return that.configureSyncOptions(); }
});
}
private registerShowActivityAction(): void {
const that = this;
registerAction2(class ShowSyncActivityAction extends Action2 {
constructor() {
super({
id: showSyncActivityCommand.id,
title: showSyncActivityCommand.title,
menu: {
id: MenuId.CommandPalette,
when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized)),
},
});
}
run(): any { return that.showSyncActivity(); }
});
}
private registerShowSettingsAction(): void {
registerAction2(class ShowSyncSettingsAction extends Action2 {
constructor() {
super({
id: showSyncSettingsCommand.id,
title: showSyncSettingsCommand.title,
menu: {
id: MenuId.CommandPalette,
when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized)),
},
});
}
run(accessor: ServicesAccessor): any {
accessor.get(IPreferencesService).openGlobalSettings(false, { query: 'sync:' });
}
});
}
}
class UserDataRemoteContentProvider implements ITextModelContentProvider {