“This is my 28th day of participating in the First Challenge 2022. For details: First Challenge 2022.”
Public account “Cicada Mu wind”, welcome everyone to pay attention to exchange
1. Settings Sync plug-in
The Setings Sync plugin allows you to synchronize your VSCode configuration to Github Gist. When you replace your PC and rebuild your VSCode environment, you can use the plugin to pull out your previously synchronized configuration without having to start all over again
Gist is simply a repository of snippets of code
2. Tutorial
2.1 Download and Install for novices
Click the Extension button, search Setings Sync and install it, and the following screen will automatically pop up
Click the LOGIN WITH GITHUB button and enter your username and password for authorization
If you’ve never created any Gist, hopefully you’ll see this screen
This is telling you
You didn’t find any Gist in your account. Clicking SKIP will automatically create a Gist for you to synchronize with VSCode configuration
If you’ve ever created a Gist, it lists all of them, and you just need to synchronize one of them.
If you’re new to the Settings Sync plugin and have never done the tokenization before, you’re probably ready to upload the configuration at this point.
Thanks to the fact that VSCode and Github are owned by the same company (Microsoft), the Gist ID and Token are automatically configured for you. Click EDIT CONFIGURATION to see what is automatically generated for you
If your “get Token” section is empty, don’t worry, try uploading configuration first to see if it works, and then forget about it
Upload configuration shortcut keys, upload a try
Windows: Shift + Alt + U
MacOS: Shift + Option + U
2.2 Verifying the Configuration
If VSCode has told you that the synchronization was successful, it was successful. Gists if you don’t believe me, go to Github, click Your avatar, and click Your gists
The configuration has been successfully uploaded to Gist
Click through to the Gist and look at the string of numbers behind the address bar. This is the Gist ID (which is the automatic configuration information mentioned above), and the plugin needs to know which Gist to synchronize the configuration to
At this point, if your configuration is successful, skip parts 3 and 4 and see how to pull the configuration.
3. If this process doesn’t work out for you
If you have a special constitution and have trouble installing, read on
All this plugin needs is two pieces of information
Gist ID
Token
If the system doesn’t automatically generate it for you, do it yourself
3.1 create the Gist
Click the + button on the top right of the Gist list page to create a Gist
Find your Gist ID once you’ve created it
Gist stops there, and then you get the Token
3.2 create a Token
Go to Github, click on your avatar, click on Settings, go to Developer Settings in the left pane, and click on Personal Access Tokens
Click the Generate New Token button, write your Note, select Expiration time (I always choose permanent), and check the GIST option. .
Click the Generate Token button to Generate a token. Be sure to save it after you Generate it, because you will only see it once!
3.3 Configuring Plug-ins
Fill these two information into the plug-in’s configuration file.
And you’re done!
4. I had an even more unpleasant experience
It was obviously the first time I installed this plug-in on the original computer, and I thought everything would be automatically configured for me. However, when I synchronized the configuration, I got this error message
Sync: GitHub token is invalid or expired. Please rebuild.
I forgot when I got tokens, so I went through step 3 and got Gist ID and Token.
However!! The following interface will not appear in my VSCode at all. I can’t configure the plugin without it.
I thought about reinstalling and slapped myself in the face when I was supposed to synchronize VSCode configuration on this computer.
Here are the steps
4.1 Locate the Configuration file of the Settings Sync plug-in
-
Click on the plugins button, locate the Settings Sync plugin, and click on the gear in the lower right
-
Click the Extension Settings button and all configuration items appear on the right
-
choose
Extensions - Code Settings Sync
All visual configurations of the plug-in appear -
Click on the top right
Open Settings (JSON)
Button, look at the part I circled in the picture, is the directory where VSCode’s configuration file is located
4.2 modify syncLocalSettings. Json
Enter theCode/User
Directory, andsettings.json
There’s a file at the same levelsyncLocalSettings.json
File, modify thetoken
Then you can happily synchronize the configuration!
5. Pull the configuration
The shortcut keys for pulling up the synchronization configuration on another computer are as follows
Windows: Shift + Alt + D
MacOS: Shift + Option + D
Finished!