Vscode: Opt in syncing global state

Created on 24 Mar 2020  路  19Comments  路  Source: microsoft/vscode

We support now syncing global state - #86679. It is an opt in functionality. If you think the global state you own shall be synced, you have to opt in by registering your global state key to be syncable.

Ref:
https://github.com/microsoft/vscode/blob/8410ac753f2fbb6c856c139d889d95aff9769eb8/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts#L365

As shown above, you have to provide the storage key that has to be key along with version number. Versioning gives you flexibility to change your storage data semantics and makes sure old clients does not sync old data.

@microsoft/vscode Please find references to StorageScope.Global and check the state you own and opt in to sync if you think so.

Guidelines: Here are some guidelines to follow. They are not fixed, feel free to add

  • Do not sync if state contains paths
  • Do not sync if state is machine associated like any dimensions.
  • Make sure the state update works across multiple windows of the same VS Code instance

Here is the list of usages. Please check off either by opting in or not


Completed (March + April)

  • [x] src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts - @jrieken
  • [x] src/vs/editor/contrib/suggest/suggestMemory.ts - @jrieken
  • [x] src/vs/editor/contrib/suggest/suggestWidget.ts - @jrieken
  • [x] src/vs/platform/extensionManagement/common/extensionEnablementService.ts - @sandy081
  • [x] src/vs/platform/quickinput/browser/commandsQuickAccess.ts - @bpasero
  • [x] src/vs/platform/serviceMachineId/common/serviceMachineId.ts - @sandy081
  • [x] src/vs/platform/userDataSync/common/userDataSyncService.ts - @sandy081
  • [x] src/vs/workbench/browser/parts/activitybar/activitybarPart.ts - @sandy081
  • [x] src/vs/workbench/browser/parts/editor/editorPart.ts - @isidorn
  • [x] src/vs/workbench/browser/parts/panel/panelPart.ts - @sandy081
  • [x] src/vs/workbench/browser/parts/statusbar/statusbarPart.ts - @sandy081
  • [x] src/vs/workbench/browser/parts/titlebar/menubarControl.ts - @sbatten
  • [x] src/vs/workbench/browser/parts/views/views.ts - @sandy081
  • [x] src/vs/workbench/browser/workbench.ts - @bpasero
  • [x] src/vs/workbench/contrib/bulkEdit/browser/bulkEditPane.ts - @jrieken
  • [x] src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.ts - @jrieken
  • [x] src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts - @jrieken
  • [x] src/vs/workbench/contrib/debug/browser/debugToolBar.ts - @isidorn
  • [x] src/vs/workbench/contrib/experiments/common/experimentService.ts - @connor4312
  • [x] src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts - @bpasero
  • [x] src/vs/workbench/contrib/localizations/browser/localizations.contribution.ts - @sandy081
  • [x] src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts - @roblourens
  • [x] src/vs/workbench/contrib/quickopen/browser/commandsHandler.ts - @bpasero
  • [x] src/vs/workbench/contrib/remote/browser/explorerViewItems.ts - @alexr00
  • [x] src/vs/workbench/contrib/terminal/browser/terminalInstance.ts (not a good candidate) - @Tyriar
  • [x] src/vs/workbench/services/notification/common/notificationService.ts - @bpasero
  • [x] src/vs/workbench/services/remote/common/remoteExplorerService.ts - @alexr00
  • [x] src/vs/workbench/services/textMate/browser/abstractTextMateService.ts - @alexdima
  • [x] src/vs/workbench/services/views/browser/viewDescriptorService.ts - @sandy081
  • [x] src/vs/workbench/services/workspaces/browser/workspacesService.ts - @bpasero
  • [x] src/vs/workbench/contrib/url/common/trustedDomains.ts - @octref
  • [x] src/vs/workbench/contrib/url/common/trustedDomainsFileSystemProvider.ts - @octref
  • [x] src/vs/editor/contrib/find/findWidget.ts - @rebornix
  • [x] src/vs/platform/telemetry/browser/workbenchCommonProperties.ts - @RMacfarlane
  • [x] src/vs/platform/telemetry/node/workbenchCommonProperties.ts - @RMacfarlane
  • [x] src/vs/workbench/api/browser/mainThreadAuthentication.ts - @RMacfarlane
  • [x] src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts - @sandy081
  • [x] src/vs/workbench/contrib/surveys/browser/languageSurveys.contribution.ts - @egamma
  • [x] src/vs/workbench/contrib/surveys/browser/nps.contribution.ts - @egamma
  • [x] src/vs/workbench/electron-browser/window.ts - @deepak1556
  • [x] src/vs/workbench/services/integrity/node/integrityService.ts - @alexdima
  • [x] src/vs/workbench/services/themes/browser/fileIconThemeData.ts - @aeschli
  • [x] src/vs/workbench/services/themes/browser/productIconThemeData.ts - @aeschli
  • [x] src/vs/workbench/services/themes/browser/workbenchThemeService.ts - @aeschli
  • [x] src/vs/workbench/services/themes/common/colorThemeData.ts - @aeschli
  • [x] src/vs/workbench/contrib/update/browser/update.ts - @joaomoreno
  • [x] src/vs/workbench/services/extensions/browser/extensionUrlHandler.ts - @joaomoreno

  • [x] src/vs/workbench/browser/layout.ts - @sbatten
  • [x] src/vs/workbench/contrib/welcome/telemetryOptOut/browser/telemetryOptOut.ts - @sbatten
  • [ ] src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts - @sandy081
debt settings-sync

Most helpful comment

I fee they should be synced. Its the user choice and as a I user I want my choice to be synced.

All 19 comments

Went through mine and did not fine good candidates for this.

I added a few. There are some which I am unsure, such as NPS surveys or extension tips. My feeling is they should be synced too.

@sandy081 I tried to adopt the service for notifications that offer a "Do not show again" action, but get tons of exceptions when requiring it in my layer. I think I cannot depend on that service as it seems to drag in other things? Try adding the dependency to notificationService.ts to see that in action.

@bpasero I tried adding IStorageKeysSyncRegistryService to notificationService.ts and it seems to work for me. I did not see any errors.

Sorry, nevermind. I pushed a change to register these keys.

NPS and language surveys is probably PM/DevLead decision, I assigned @egamma

@microsoft/vscode

Those who opted in to sync their global state, can you please provide steps to verify them in the comment below

Verify that following state is synced

  • Activity bar icons and order

    • Status bar items

    • Panel items and order

    • Workbench views layout and visibility. Note: Views order is not yet synced

Commands: the recently used command is being synced to the other machine.

for outline make sure this UX state is sync'd

Screenshot 2020-03-31 at 10 07 31

Recently used and commands and Outline state are not getting synced.

I do not think experiment state should be synced at this time. We store evaluation results there, and between computers those results might be different. For instance, say we have an insiders-only experiment. If I happen to open stable first, that will evaluate to NoRun, and then syncs to my insiders instance, preventing me from ever seeing the experiment. We might want to add other user-global conditions later but for now I think keeping them locally is fine.

@sandy081 Wondering what you think about trusted domains. I feel it shouldn't be synced but I could be convinced otherwise.

I fee they should be synced. Its the user choice and as a I user I want my choice to be synced.

@octref Can you please provide steps to test if trusted domains are synced and working as expected?

@sandy081 Added trusted domains.

@sandy081 the crashreporter guid is machine dependent, it should not be synced. Removing my assignment.

Added trusted extensions.

To verify:

  • Sign in with GH account to settings sync
  • Write test extension that tries to access this same token:
    const session = await vscode.authentication.login("github", ['user:email']);
    const token = await session.getAccessToken();
    vscode.window.showInformationMessage('Successfully logged in');

Should be prompted to confirm that extension can access auth info on the first machine, and not see the consent dialog on subsequent machines when using the same extension id

For themes what's stored are the cached theme colors to avoid flickering on reload. We will not sync these at they also contain paths.

We still have 3 instances to fix from @sbatten and me.

One from me is not as simple as registering the keys as it needs updating the extensions resource while syncing. This is about locking the extension version to install. So will look into it early next milestone.

@sbatten Please take a look at the other two entries that are assigned to you.

Was this page helpful?
0 / 5 - 0 ratings