loading...

Code Settings Sync Configurations

shanalikhan profile image Shan Khan Originally published at shanalikhan.github.io on ・4 min read

There are two types of configurations for Settings Sync in terms of their scope.

  • Gist Setting
  • Global Settings

Setting Sync Global Settings is the setting which applies on all the Visual Studio Code environment while the scope of Gist Settings are only limited to Visual Studio current environment.

For Example: GitHub Token is a part of Global Settings of two reasons, first its sensitive information for the user that we cannot allow to upload the GitHub token along-with code settings in Gist. Second its applicable with all Gist, it's required to download any Gist.

Gist Settings

{  
    "sync.gist": "",
    "sync.autoDownload": false,
    "sync.autoUpload": false,
    "sync.forceDownload": false,
    "sync.removeExtensions": true,
    "sync.syncExtensions": true,
    "sync.forceUpload": false,
    "sync.quietSync": false
}

Gist Settings are stored in Visual Studio code settings.json with the sync prefix and may vary with different Gist ( Visual Studio Environments) and will be replaced by the new downloaded Settings.

  • Gist: Github Gist ID
  • autoDownload: false by default. If you set it to true it will download the settings automatically when code is started.
  • autoUpload : false by default. It will start download process automatically when Visual Studio Loads when set to true , false will not allow extension to auto download the settings upon startup.
  • quietSync : false by default. It will show the summary page when download or upload process completes displaying the files changed and extensions added or removed. Setting false will allow quiet process in the background and only notify via editor statusbar.
  • forceDownload : false by default. If you set it to true it will overwrite the existing settings everytime the download process initiated either manually or on start.
  • syncExtensions : true by default. It allows Settings Sync to sync your extensions list in gist so when you download it will automatically install the extensions list in code.
  • removeExtensions: true by default. When syncExtensions is true and extensions list are downloaded. It allows Setting Sync to remove those extensions which are not a part of downloaded list of extensions. If you want to sync with new extensions and dont want to remove extra extensions keep this config to false Settings sync will not delete extensions.
Global Settings

Global Settings are stored in the User folder with the file name syncLocalSettings.json.

{
    "ignoreUploadFiles": [
        "state.*",
        "syncLocalSettings.json",
        ".DS_Store",
        "sync.lock",
        "projects.json",
        "projects_cache_vscode.json",
        "projects_cache_git.json",
        "projects_cache_svn.json",
        "gpm_projects.json",
        "gpm-recentItems.json"
    ],
    "ignoreUploadFolders": [ "workspaceStorage"],
    "ignoreExtensions": [],
    "gistDescription": "Visual Studio Code Settings Sync Gist",
    "version": 341,
    "token": "",
    "downloadPublicGist": false,
    "supportedFileExtensions": [ "json","code-snippets"],
    "disableUpdateMessage": false,
    "lastUpload": null,
    "lastDownload": null,
    "githubEnterpriseUrl": null,
    "askGistName": false,
    "customFiles": {},
    "hostName": null,
    "universalKeybindings": false,
    "autoUploadDelay": 20
}
  • ignoreUploadFiles: All the files inside this key will stop extension to upload the files. You need to only write the file name of file. Any file found with this name inside User folder or subfolders won’t be uploaded. Like in the above example, the projects.json and projects_cache_git.json will not be uploaded to Github Gist.

  • ignoreUploadFolders: All the folder names defined in it will not be uploaded in Gist, Folder can be child of User folder or child of any subfolder. Like in the above example, workspaceStorage folder files will not be uploaded to Github Gist.

  • gistDescription: This is the name of gist you are going to create. Very helpful when you have multiple environments ( e.g Home Settings, Work Settings ) you can name those gist and download them by identifying.

  • token: The GitHub User secret identifier in order to allow Settings Sync upload and download the gist. Token is automatically generated by the Settings Sync UI when you login via GitHub. You can also manual generate token from Github and paste here.

  • supportedFileExtensions: It allows Settings Sync to upload only the files in gist which extension are defined. By default Settings Sync only uploads json and code-snippets.

  • downloadPublicGist: false by default. Set it to true if you are looking forward to make Setting Sync only download mode. For example, team member looking forward to the team environment. Set it to true and Settings Sync will only download the Gist and will never ask for token in order to download.

  • ignoreExtensions: Add any extension name in order to ignore from upload / download process. For example : Add beautify if you want to ignore beautify extension to upload and download from the Gist.

  • disableUpdateMessage: false by default. Set it to true when you are looking forward to disable the extension update messages.

  • githubEnterpriseUrl and hostName: Setup enterprise url and hostname when you want to use Github enterprise for Settings Sync.

  • askGistName: - askGistName: false by default. When set to true allows user to set Gist name while creating new one. Very helpful when you have multiple environments ( e.g Home Settings, Work Settings ) you can name those gist and download them by identifying.

  • universalKeybindings: false by default. Set it to true if you want a single keybindings.json for MacOS, Linux and Windows.

  • autoUploadDelay: Default is 20 seconds. Change the seconds interval to allow Settings Sync to upload the settings on change.

  • customFiles: Allow you to sync files outside the User folder. For details read the wiki post here

lastDownload and lastUpload is just to keep record of download and upload status. You can set it to empty to hit manual download process.

Let me know if you have any questions.

Discussion

markdown guide
 

I want to bootstrap an environment. So I've figured where and how to create the necessary configuration files with the gist and token and I want afterwards to invoke the download of the settings which you would normally do from the command pallete.

Something like this

code aparameter extensionname command

e.g.

code shan.code-settings-sync extension.downloadSettings