“This is the 29th day of my participation in the First Challenge 2022. For details: First Challenge 2022.”

Public account “Cicada Mu wind”, welcome everyone to pay attention to exchange


preface

These days when I was migrating the working environment of the computer, I really didn’t want to download the plug-in and configure the code rules from the beginning, so I turned to Baidu for help. The solutions that came up the top in the search results were basically using the Setings Sync plug-in, so I followed it.

After a lot of toss and turn, even stepped on the Internet is difficult to find a solution pit, sincere full wrote a synchronous article. Then a friend commented and told me there was an official solution.

So in order to let more friends know about this solution, I looked up VSCode’s official documentation and decided to write another article on VSCode configuration synchronization.

How does VSCode Settings Sync relate to the Settings Sync plugin?

I have to give credit to the Settings Sync plugin for its functionality, and although I stumbled a bit, it did meet my needs. The name is Settings Sync. What does that have to do with anything?

The official explanation: it doesn’t matter!

Two ways I have experienced, my experience is: or the official incense, convenient is not a little bit, strongly recommend the direct introduction of the official synchronization scheme!


Next, we will introduce VSCode’s official configuration synchronization solution.

Enable the Settings Sync function

Settings Sync is disabled by default. Click on the gear in the lower left of VSCode to enable Settings Sync

The following screen will then appear, allowing you to select the content you want to synchronize, including the following 5 types (don’t bother to select all of them) :

  • Settings
  • Keyboard Shortcuts
  • Extensions
  • User Snippets
  • UI State

Click the Sign in & Turn on button and select the login method. It doesn’t matter which one you choose, as long as you use the same account to log in from now on.

Here I choose Sign in with your GitHub.

After selecting the login mode and successfully logging in, Settings Sync is enabled and VSCode will automatically synchronize the selected content in the background.

Merge or Replace?

Yes, it’s been configured so far, isn’t it super simple? Now VSCode has silently synchronized the configuration for you in the background, when you synchronize the configuration uploaded by other devices, the following dialog box may pop up, according to your own needs to deal with.

  • Merge: Merges remote and local configurations
  • Replace Local: The remote configuration replaces the Local configuration
  • Merge Manually… : Manual merge

What if there is a conflict during configuration synchronization?

When synchronizing data between multiple devices, conflicts may occur. When a conflict occurs, the following prompts will appear:

  • Accept Local: Override remote configuration with Local configuration
  • Accept Remote: Use Remote configuration to override local configuration
  • Show Conflicts: Handles Conflicts manually

Or according to their own needs to handle.

Can I switch the account later

You can.

You can turn Off Settings Sync at any time and use another account to turn it on.

Can the configuration be rolled back if it is incorrect

VSCode will save your local and remote backups while synchronizing data, and you can roll them back if you encounter configuration errors.

Using the Settings Sync: Show Synced Data command in the command panel, you can see a view of three synchronized records

  • SYNC ACTIVITY (REMOTE) : Records REMOTE synchronization
  • SYNC ACTIVITY (LOCAL) : indicates the LOCAL synchronization record
  • SYNCED MACHINES: synchronized devices

Note that the **SYNC ACTIVITY (LOCAL) ** view is disabled by default.

Version back

Select the version you want to roll back from the **SYNC ACTIVITY (REMOTE) or SYNC ACTIVITY (LOCAL) ** view and click the icon on the right to roll back.

Viewing Historical Devices

The SYNCED MACHINES view shows all the devices that you have synchronized configuration and is automatically named according to VSCode version (internal/stable) and device operating system. You can change the name by clicking the “Pencil” button. You can also right-click on the device and select the Turn off Settings Sync menu to disable synchronization on that device.

What if I want to delete all configurations?

Click the gear button, then select the Settings Sync is On menu, and remember to check the box in the image to delete all saved configurations. The next time you open Settings Sync, you start all over again.


VSCode official synchronization scheme is briefly introduced here, enough for most partners to use, if you have more questions about synchronization, please refer to the OFFICIAL documents of VSCode.

See you next time!