Earlier this year, I watched a recording of the January 2019 Arizona PowerShell User Group meeting where Tim Warner presented a session on Easing your transition from the PowerShell ISE to Visual Studio Code. One of the things Tim demonstrated was a VSCode extension named Settings Sync where you can synchronize your VSCode settings to and from a GitHub Gist. While it seems to be designed to synchronize your settings between multiple computers, I recently found out that it can also be a lifesaver even if you only use it on one computer.
In VSCode, press F1 or Ctrl + Shift + P to open the command palette. Then click the square extensions icon on the left (or Ctrl + Shift + X), search for the “settings sync” extension, and click install.
Open the command palette again (F1 is easier and fewer keys to type than Ctrl + Shift + P). Search for commands that begin with “sync” and click “Sync: Update / Upload Settings” (or Shift
- Alt + U).
This will open the access tokens page of your GitHub account. Create a new access token.
Give it a meaningful description and only grant it the ability to create Gists.
Copy the access token as this will be your only chance to see it.
Go back to VSCode. You’ll notice the Settings Sync extension is waiting for an access token. Paste the access token and press enter.
You’ll see what was uploaded in the output window of VSCode.
Use the “Sync: Download Settings” (or Shift + Alt + D) option on your other computers.
There are a few other options I prefer to set in “Sync: Advanced Options”.
“Sync: Toggle Auto-Upload On Settings Change”, “Sync: Toggle Auto-Download on Startup”, and “Sync: Toggle Show Summary Page on Upload / Download”.
All of these settings can be found within the settings section in VSCode. The ID for the Gist that was created can also be found there.
Recently, I reloaded my primary work computer and while I thought I had everything important backed up, the one thing I was missing was my VSCode settings. Thankfully, I had installed and configured the “Sync Settings” extension, so recovering my settings was as simple as reinstalling that extension and configuring it to download my settings from the private Gist it previously created.
For security reasons, both the GitHub access token and Gist shown in this blog article have already been deleted.