VS Code merge to df8fe74bd55313de0dd2303bc47a4aab0ca56b0e (#17979)

* Merge from vscode 504f934659740e9d41501cad9f162b54d7745ad9

* delete unused folders

* distro

* Bump build node version

* update chokidar

* FIx hygiene errors

* distro

* Fix extension lint issues

* Remove strict-vscode

* Add copyright header exemptions

* Bump vscode-extension-telemetry to fix webpacking issue with zone.js

* distro

* Fix failing tests (revert marked.js back to current one until we decide to update)

* Skip searchmodel test

* Fix mac build

* temp debug script loading

* Try disabling coverage

* log error too

* Revert "log error too"

This reverts commit af0183e5d4ab458fdf44b88fbfab9908d090526f.

* Revert "temp debug script loading"

This reverts commit 3d687d541c76db2c5b55626c78ae448d3c25089c.

* Add comments explaining coverage disabling

* Fix ansi_up loading issue

* Merge latest from ads

* Use newer option

* Fix compile

* add debug logging warn

* Always log stack

* log more

* undo debug

* Update to use correct base path (+cleanup)

* distro

* fix compile errors

* Remove strict-vscode

* Fix sql editors not showing

* Show db dropdown input & fix styling

* Fix more info in gallery

* Fix gallery asset requests

* Delete unused workflow

* Fix tapable resolutions for smoke test compile error

* Fix smoke compile

* Disable crash reporting

* Disable interactive

Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
Charles Gagnon
2022-01-06 09:06:56 -08:00
committed by GitHub
parent fd2736b6a6
commit 2bc6a0cd01
2099 changed files with 79520 additions and 43813 deletions

View File

@@ -54,6 +54,10 @@ import { UserDataSyncDataViews } from 'vs/workbench/contrib/userDataSync/browser
import { IUserDataSyncWorkbenchService, getSyncAreaLabel, AccountStatus, CONTEXT_SYNC_STATE, CONTEXT_SYNC_ENABLEMENT, CONTEXT_ACCOUNT_STATE, CONFIGURE_SYNC_COMMAND_ID, SHOW_SYNC_LOG_COMMAND_ID, SYNC_VIEW_CONTAINER_ID, SYNC_TITLE, SYNC_VIEW_ICON } from 'vs/workbench/services/userDataSync/common/userDataSync';
import { Codicon } from 'vs/base/common/codicons';
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { EditorResolution } from 'vs/platform/editor/common/editor';
import { CATEGORIES } from 'vs/workbench/common/actions';
import { IUserDataInitializationService } from 'vs/workbench/services/userData/browser/userDataInit';
import { MarkdownString } from 'vs/base/common/htmlContent';
const CONTEXT_CONFLICTS_SOURCES = new RawContextKey<string>('conflictsSources', '');
@@ -86,10 +90,12 @@ const syncNowCommand = {
const showSyncSettingsCommand = { id: 'workbench.userDataSync.actions.settings', title: localize('sync settings', "{0}: Show Settings", SYNC_TITLE), };
const showSyncedDataCommand = { id: 'workbench.userDataSync.actions.showSyncedData', title: localize('show synced data', "{0}: Show Synced Data", SYNC_TITLE), };
const CONTEXT_SYNC_AFTER_INITIALIZATION = new RawContextKey<false>('syncAfterInitialization', false);
const CONTEXT_TURNING_ON_STATE = new RawContextKey<false>('userDataSyncTurningOn', false);
export class UserDataSyncWorkbenchContribution extends Disposable implements IWorkbenchContribution {
private readonly syncAfterInitializationContext: IContextKey<boolean>;
private readonly turningOnSyncContext: IContextKey<boolean>;
private readonly conflictsSources: IContextKey<string>;
@@ -121,15 +127,18 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
@IAuthenticationService private readonly authenticationService: IAuthenticationService,
@IUserDataSyncStoreManagementService private readonly userDataSyncStoreManagementService: IUserDataSyncStoreManagementService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IUserDataInitializationService private readonly userDataInitializationService: IUserDataInitializationService,
) {
super();
this.syncAfterInitializationContext = CONTEXT_SYNC_AFTER_INITIALIZATION.bindTo(contextKeyService);
this.turningOnSyncContext = CONTEXT_TURNING_ON_STATE.bindTo(contextKeyService);
this.conflictsSources = CONTEXT_CONFLICTS_SOURCES.bindTo(contextKeyService);
if (userDataSyncWorkbenchService.enabled) {
registerConfiguration();
this.initializeSyncAfterInitializationContext();
this.updateAccountBadge();
this.updateGlobalActivityBadge();
this.onDidChangeConflicts(this.userDataSyncService.conflicts);
@@ -167,6 +176,27 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
this.updateGlobalActivityBadge();
}
private async initializeSyncAfterInitializationContext(): Promise<void> {
const requiresInitialization = await this.userDataInitializationService.requiresInitialization();
if (requiresInitialization && !this.userDataAutoSyncEnablementService.isEnabled()) {
this.updateSyncAfterInitializationContext(true);
} else {
this.updateSyncAfterInitializationContext(this.storageService.getBoolean(CONTEXT_SYNC_AFTER_INITIALIZATION.key, StorageScope.GLOBAL, false));
}
const disposable = this._register(this.userDataAutoSyncEnablementService.onDidChangeEnablement(() => {
if (this.userDataAutoSyncEnablementService.isEnabled()) {
this.updateSyncAfterInitializationContext(false);
disposable.dispose();
}
}));
}
private async updateSyncAfterInitializationContext(value: boolean): Promise<void> {
this.storageService.store(CONTEXT_SYNC_AFTER_INITIALIZATION.key, value, StorageScope.GLOBAL, StorageTarget.MACHINE);
this.syncAfterInitializationContext.set(value);
this.updateGlobalActivityBadge();
}
private readonly conflictsDisposables = new Map<SyncResource, IDisposable>();
private onDidChangeConflicts(conflicts: [SyncResource, IResourcePreview[]][]) {
if (!this.userDataAutoSyncEnablementService.isEnabled()) {
@@ -364,7 +394,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
message: operationId ? `${message} ${operationId}` : message,
actions: {
primary: [new Action('open sync file', localize('open file', "Open {0} File", getSyncAreaLabel(resource)), undefined, true,
() => resource === SyncResource.Settings ? this.preferencesService.openGlobalSettings(true) : this.preferencesService.openGlobalKeybindingSettings(true))]
() => resource === SyncResource.Settings ? this.preferencesService.openUserSettings({ jsonEditor: true }) : this.preferencesService.openGlobalKeybindingSettings(true))]
}
});
}
@@ -409,7 +439,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
message: localize('errorInvalidConfiguration', "Unable to sync {0} because the content in the file is not valid. Please open the file and correct it.", errorArea.toLowerCase()),
actions: {
primary: [new Action('open sync file', localize('open file', "Open {0} File", errorArea), undefined, true,
() => source === SyncResource.Settings ? this.preferencesService.openGlobalSettings(true) : this.preferencesService.openGlobalKeybindingSettings(true))]
() => source === SyncResource.Settings ? this.preferencesService.openUserSettings({ jsonEditor: true }) : this.preferencesService.openGlobalKeybindingSettings(true))]
}
});
this.invalidContentErrorDisposables.set(source, toDisposable(() => {
@@ -432,6 +462,8 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
badge = new ProgressBadge(() => localize('turning on syncing', "Turning on Settings Sync..."));
clazz = 'progress-badge';
priority = 1;
} else if (this.userDataSyncWorkbenchService.accountStatus === AccountStatus.Available && this.syncAfterInitializationContext.get() && !this.userDataAutoSyncEnablementService.isEnabled()) {
badge = new NumberBadge(1, () => localize('settings sync is off', "Settings Sync is Off", SYNC_TITLE));
}
if (badge) {
@@ -453,16 +485,36 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
}
}
private async turnOnSyncAfterInitialization(): Promise<void> {
this.updateSyncAfterInitializationContext(false);
const result = await this.dialogService.show(
Severity.Info,
localize('settings sync is off', "Settings Sync is Off"),
[
localize('turn on settings sync', "Turn On Settings Sync"),
localize('cancel', "Cancel"),
],
{
cancelId: 1,
custom: {
markdownDetails: [{
markdown: new MarkdownString(`${localize('turnon sync after initialization message', "Your settings, keybindings, extensions, snippets and UI State were initialized but are not getting synced. Do you want to turn on Settings Sync?")}`, { isTrusted: true })
}, {
markdown: new MarkdownString(`${localize({ key: 'change later', comment: ['Context here is that user can change (turn on/off) settings sync later.'] }, "You can always change this later.")} [${localize('learn more', "Learn More")}](https://aka.ms/vscode-settings-sync-help).`, { isTrusted: true })
}]
}
}
);
if (result.choice === 0) {
await this.userDataSyncWorkbenchService.turnOnUsingCurrentAccount();
}
}
private async turnOn(): Promise<void> {
try {
if (!this.userDataSyncWorkbenchService.authenticationProviders.length) {
throw new Error(localize('no authentication providers', "No authentication providers are available."));
}
if (!this.storageService.getBoolean('sync.donotAskPreviewConfirmation', StorageScope.GLOBAL, false)) {
if (!await this.askForConfirmation()) {
return;
}
}
const turnOn = await this.askToConfigure();
if (!turnOn) {
return;
@@ -471,7 +523,6 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
await this.selectSettingsSyncService(this.userDataSyncStoreManagementService.userDataSyncStore);
}
await this.userDataSyncWorkbenchService.turnOn();
this.storageService.store('sync.donotAskPreviewConfirmation', true, StorageScope.GLOBAL, StorageTarget.MACHINE);
} catch (e) {
if (isPromiseCanceledError(e)) {
return;
@@ -517,26 +568,6 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
}
}
private async askForConfirmation(): Promise<boolean> {
const result = await this.dialogService.show(
Severity.Info,
localize('sync preview message', "Synchronizing your settings is a preview feature, please read the documentation before turning it on."),
[
localize('turn on', "Turn On"),
localize('open doc', "Open Documentation"),
localize('cancel', "Cancel"),
],
{
cancelId: 2
}
);
switch (result.choice) {
case 1: this.openerService.open(URI.parse('https://aka.ms/vscode-settings-sync-help')); return false;
case 2: return false;
}
return true;
}
private async askToConfigure(): Promise<boolean> {
return new Promise<boolean>((c, e) => {
const disposables: DisposableStore = new DisposableStore();
@@ -684,14 +715,15 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
const leftResourceName = localize({ key: 'leftResourceName', comment: ['remote as in file in cloud'] }, "{0} (Remote)", basename(conflict.remoteResource));
const rightResourceName = localize('merges', "{0} (Merges)", basename(conflict.previewResource));
await this.editorService.openEditor({
originalInput: { resource: conflict.remoteResource },
modifiedInput: { resource: conflict.previewResource },
original: { resource: conflict.remoteResource },
modified: { resource: conflict.previewResource },
label: localize('sideBySideLabels', "{0} ↔ {1}", leftResourceName, rightResourceName),
description: localize('sideBySideDescription', "Settings Sync"),
options: {
preserveFocus: false,
pinned: true,
revealIfVisible: true,
override: EditorResolution.DISABLED
},
});
}
@@ -747,8 +779,9 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
if (this.userDataAutoSyncEnablementService.canToggleEnablement()) {
this.registerTurnOnSyncAction();
this.registerTurnOffSyncAction();
this.registerTurnOnSyncAfterInitializationAction();
}
this.registerTurninOnSyncAction();
this.registerTurningOnSyncAction();
this.registerSignInAction(); // When Sync is turned on from CLI
this.registerShowSettingsConflictsAction();
this.registerShowKeybindingsConflictsAction();
@@ -759,6 +792,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
this.registerSyncNowAction();
this.registerConfigureSyncAction();
this.registerShowSettingsAction();
this.registerHelpAction();
this.registerShowLogAction();
this.registerResetSyncDataAction();
}
@@ -772,7 +806,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
id: turnOnSyncCommand.id,
title: localize('global activity turn on sync', "Turn on Settings Sync...")
},
when: turnOnSyncWhenContext,
when: ContextKeyExpr.and(turnOnSyncWhenContext, CONTEXT_SYNC_AFTER_INITIALIZATION.negate()),
order: 1
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
@@ -797,7 +831,34 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
});
}
private registerTurninOnSyncAction(): void {
private registerTurnOnSyncAfterInitializationAction(): void {
const that = this;
const id = 'workbench.userData.actions.askToTunrOnAfterInit';
const when = ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), CONTEXT_SYNC_ENABLEMENT.toNegated(), CONTEXT_ACCOUNT_STATE.isEqualTo(AccountStatus.Available), CONTEXT_TURNING_ON_STATE.negate(), CONTEXT_SYNC_AFTER_INITIALIZATION);
this._register(registerAction2(class AskToTurnOnSync extends Action2 {
constructor() {
super({
id,
title: localize('ask to turn on in global', "Settings Sync is Off (1)"),
menu: {
group: '5_sync',
id: MenuId.GlobalActivity,
when,
order: 2
}
});
}
async run(): Promise<any> {
try {
await that.turnOnSyncAfterInitialization();
} catch (e) {
that.notificationService.error(e);
}
}
}));
}
private registerTurningOnSyncAction(): void {
const when = ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), CONTEXT_SYNC_ENABLEMENT.toNegated(), CONTEXT_ACCOUNT_STATE.notEqualsTo(AccountStatus.Uninitialized), CONTEXT_TURNING_ON_STATE);
this._register(registerAction2(class TurningOnSyncAction extends Action2 {
constructor() {
@@ -1147,11 +1208,37 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
});
}
run(accessor: ServicesAccessor): any {
accessor.get(IPreferencesService).openGlobalSettings(false, { query: '@tag:sync' });
accessor.get(IPreferencesService).openUserSettings({ jsonEditor: false, query: '@tag:sync' });
}
}));
}
private registerHelpAction(): void {
const that = this;
this._register(registerAction2(class HelpAction extends Action2 {
constructor() {
super({
id: 'workbench.userDataSync.actions.help',
title: { value: SYNC_TITLE, original: 'Settings Sync' },
category: CATEGORIES.Help,
menu: [{
id: MenuId.CommandPalette,
when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized)),
}],
});
}
run(): any { return that.openerService.open(URI.parse('https://aka.ms/vscode-settings-sync-help')); }
}));
MenuRegistry.appendMenuItem(MenuId.ViewContainerTitle, {
command: {
id: 'workbench.userDataSync.actions.help',
title: CATEGORIES.Help.value
},
when: ContextKeyEqualsExpr.create('viewContainer', SYNC_VIEW_CONTAINER_ID),
group: '1_help',
});
}
private registerViews(): void {
const container = this.registerViewContainer();
this.registerDataViews(container);
@@ -1180,7 +1267,8 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
title: localize('workbench.actions.syncData.reset', "Clear Data in Cloud..."),
menu: [{
id: MenuId.ViewContainerTitle,
when: ContextKeyEqualsExpr.create('viewContainer', SYNC_VIEW_CONTAINER_ID)
when: ContextKeyEqualsExpr.create('viewContainer', SYNC_VIEW_CONTAINER_ID),
group: '0_configure',
}],
});
}
@@ -1272,7 +1360,7 @@ class AcceptChangesContribution extends Disposable implements IEditorContributio
}
if (syncResourceConflicts[1].some(({ remoteResource }) => isEqual(remoteResource, model.uri))) {
return this.configurationService.getValue<boolean>('diffEditor.renderSideBySide');
return this.configurationService.getValue('diffEditor.renderSideBySide');
}
return false;

View File

@@ -38,6 +38,7 @@ import { FloatingClickWidget } from 'vs/workbench/browser/codeeditor';
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { Severity } from 'vs/platform/notification/common/notification';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { EditorResolution } from 'vs/platform/editor/common/editor';
export class UserDataSyncMergesViewPane extends TreeViewPane {
@@ -315,14 +316,15 @@ export class UserDataSyncMergesViewPane extends TreeViewPane {
const rightResourceName = previewResource.mergeState === MergeState.Conflict ? localize('merges', "{0} (Merges)", basename(rightResource))
: localize({ key: 'rightResourceName', comment: ['local as in file in disk'] }, "{0} (Local)", basename(rightResource));
await this.editorService.openEditor({
originalInput: { resource: leftResource },
modifiedInput: { resource: rightResource },
original: { resource: leftResource },
modified: { resource: rightResource },
label: localize('sideBySideLabels', "{0} ↔ {1}", leftResourceName, rightResourceName),
description: localize('sideBySideDescription', "Settings Sync"),
options: {
preserveFocus: true,
revealIfVisible: true,
pinned: true
pinned: true,
override: EditorResolution.DISABLED
},
});
}

View File

@@ -5,18 +5,18 @@
import { Event } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { SettingsEditor2Input, PreferencesEditorInput } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
import { isWeb } from 'vs/base/common/platform';
import { isEqual } from 'vs/base/common/resources';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions';
import { IEditorInput } from 'vs/workbench/common/editor';
import { IViewsService } from 'vs/workbench/common/views';
import { IUserDataAutoSyncService } from 'vs/platform/userDataSync/common/userDataSync';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { isWeb } from 'vs/base/common/platform';
import { IEditorInput } from 'vs/workbench/common/editor';
import { IViewsService } from 'vs/workbench/common/views';
import { VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { KeybindingsEditorInput } from 'vs/workbench/services/preferences/browser/keybindingsEditorInput';
import { SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
export class UserDataSyncTrigger extends Disposable implements IWorkbenchContribution {
@@ -52,9 +52,6 @@ export class UserDataSyncTrigger extends Disposable implements IWorkbenchContrib
if (editorInput instanceof SettingsEditor2Input) {
return 'settingsEditor';
}
if (editorInput instanceof PreferencesEditorInput) {
return 'settingsEditor';
}
if (editorInput instanceof KeybindingsEditorInput) {
return 'keybindingsEditor';
}

View File

@@ -578,14 +578,16 @@ class UserDataSyncTroubleshootViewDataProvider implements ITreeViewDataProvider
const result: ITreeItem[] = [];
for (const logFolder of logsFolders) {
const syncLogResource = this.uriIdentityService.extUri.joinPath(logFolder, this.uriIdentityService.extUri.basename(this.environmentService.userDataSyncLogResource));
result.push({
handle: syncLogResource.toString(),
collapsibleState: TreeItemCollapsibleState.None,
resourceUri: syncLogResource,
label: { label: this.uriIdentityService.extUri.basename(logFolder) },
description: this.uriIdentityService.extUri.isEqual(syncLogResource, this.environmentService.userDataSyncLogResource) ? localize({ key: 'current', comment: ['Represents current log file'] }, "Current") : undefined,
command: { id: API_OPEN_EDITOR_COMMAND_ID, title: '', arguments: [syncLogResource, undefined, undefined] },
});
if (await this.fileService.exists(syncLogResource)) {
result.push({
handle: syncLogResource.toString(),
collapsibleState: TreeItemCollapsibleState.None,
resourceUri: syncLogResource,
label: { label: this.uriIdentityService.extUri.basename(logFolder) },
description: this.uriIdentityService.extUri.isEqual(syncLogResource, this.environmentService.userDataSyncLogResource) ? localize({ key: 'current', comment: ['Represents current log file'] }, "Current") : undefined,
command: { id: API_OPEN_EDITOR_COMMAND_ID, title: '', arguments: [syncLogResource, undefined, undefined] },
});
}
}
return result;
}