团队合作中,你肯定想让每个人开发环境设置是一样的,起码基础设置是一样的。Settings Sync 满足你的需求,让新加入的成员快速搭建相同的开发环境。
对于个人而言我也希望我在做不同场景的事情的时候使用不用的配置。如纯写 markdown 的时候,写个人 Blog 的时候,
或者做前端开发的时候,可能每种场景用的插件和做的设置是不一样的,有些插件又有冲突。也做为我使用该插件的情况。
Settings Sync
General
- Settings Sync, 官方文档描述的很清楚
- Visual Studio Code Settings Sync Configurations 作者个人 Blog 更详细的说明 Configuration 部分
个人感觉如下内容你要理解:
About gists, Public and Secret Gist.
Gist Settings
同步内容的
gist-id,只有第一次操作的时候需要填写,之后就会记录到你的设置中sync.gist。Open the command palette:
Ctrl+Shift+P(Cmd+Shift+Pon Mac), 输入open user settings.1
2
3
4
5
6
7
8
9
10
11
12"sync.gist": "d9ac5f7d193ffeeec7d8459451b2217a",
"sync.host": "",
"sync.pathPrefix": "",
"sync.quietSync": false,
"sync.askGistName": false,
"sync.removeExtensions": true,
"sync.syncExtensions": true,
"sync.autoDownload": false,
"sync.autoUpload": false,
"sync.lastUpload": "2018-07-31T07:03:09.646Z",
"sync.lastDownload": "",
"sync.forceDownload": false,Global Settings
这里的 token 就是类似你的密码,想要 update / upload settings 必须要有这个,可以 GitHub 中手动重新生成。
- Open the command palette:
Ctrl+Shift+P(Cmd+Shift+Pon Mac), 输入Sync Advanced Options. - 选择
Edit Extension Local Settings
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19{
"ignoreUploadFiles": [
"projects.json",
"projects_cache_vscode.json",
"projects_cache_git.json",
"projects_cache_svn.json",
"gpm_projects.json",
"gpm-recentItems.json"
],
"ignoreUploadFolders": ["workspaceStorage"],
"ignoreExtensions": [],
"replaceCodeSettings": {},
"gistDescription": "Visual Studio Code Settings Sync Gist",
"version": 300,
"token": "e8f1678289913259c10ca55c47f44405cffb17d7",
"downloadPublicGist": false,
"supportedFileExtensions": ["json", "code-snippets"],
"openTokenLink": true
}如果你像我一样不同场景有不同的 extensions 和不同的配置,需要切换的时候,就删除配置中的
gist和token,又会提示你输入gist和token了,输入你对应的gist和token,重新同步就行了。- Open the command palette:
Install Settings Sync
- Open Visual Studio Code
- Press
Ctrl+Pto open the Quick Open dialog - Type
ext install Shan.code-settings-sync, then click enter after find the extesnion - Click reload button after Installed
Upload VSCode Settings
- Open the command palette:
Ctrl+Shift+P(Cmd+Shift+Pon Mac) sync: Update / upload settings, for first time, inputgist-id- Get
Doneinformation on OUTPUT Window
Download VSCode Settigns
- Press
ctrl+shift+P, then typesync: advance optionsto selectsync: download from public gist, ifsecret gist, skip this step. - Press
ctrl+shift+P, then typesync: download settings, then inputgist-id - Get
Doneinformation on OUTPUT Window - Reload VSCode
Tips: 如果没显示 Done,就关闭 VSCode,反复尝试几次.
Make gist Public from Secret
如何你想分享的 Secret 给别人,但是别人只能读取,不能修改(当然你提供了 token 一样可以修改)。可以将你的 gist 从 Secret 改成 Public。
- 进入 gis 的详细页面,如gistT id e7a2c92023d52bb30d9db275e506d83d
- 点击
edit修改 - 点击
make public, thenupdate secret gist.
VSCode Settings
个人 VSCode Settings 分享。
Markdown
- vscode-settings-markdown-sync
GitHub Gist: 1df6c83597056cc7f97e641efb51b288
GitHub Gist Type: Public