Code-settings-sync: Per-platform / per-hostname inline settings

Created on 21 May 2018  路  7Comments  路  Source: shanalikhan/code-settings-sync

I use code-settings-sync across multiple operating systems. replaceCodeSettings may mostly work, but I think the following approach may be more flexible/have merit.

// @beginsync hostname PERSONAL_DESKTOP
"someSetting": 3
// @endsync

// @beginsync os linux
"someLinuxOnlySetting": "foobar"
// @endsync

The @beginsync and @endsync blocks are commented out when uploaded to the gist.

// @beginsync hostname PERSONAL_DESKTOP
//@ "someSetting": 3
// @endsync

// @beginsync os linux
//@ "someLinuxOnlySetting": "foobar"
// @endsync

When synced locally, the relevant settings are uncommented. For example, on a linux machine with hostname=foo the downloaded settings would be:

// @beginsync hostname PERSONAL_DESKTOP
//@ "someSetting": 3
// @endsync

// @beginsync os linux
"someLinuxOnlySetting": "foobar"
// @endsync

Thoughts? If you're open to the idea I may have time to submit a PR.

feature-request 馃挕

Most helpful comment

I like this idea, recently started using this extension and loving it but realized I would have issues if I try to include my php executable config line when syncronizing across macOS, Windows and Linux (I use all 3 on 3 different desktops).

Having the ability to selectively exclude or re-adjust local settings on specific environments would be ideal.

+1.

All 7 comments

This is nice idea.
How about we can make something like this - can have multiple host in One OS.

// @beginsync OS:Windows  hostname:PERSONAL_DESKTOP

So if user only have OS dependent setting OS will be used , if user have multiple hostname / OS , above layout can be used.

If you're open to the idea I may have time to submit a PR.

I am open, feel feel to discuss and send PR - Will release new version once developed.

I like this idea, recently started using this extension and loving it but realized I would have issues if I try to include my php executable config line when syncronizing across macOS, Windows and Linux (I use all 3 on 3 different desktops).

Having the ability to selectively exclude or re-adjust local settings on specific environments would be ideal.

+1.

Unfortunately it looks like I won't have time to implement this; I realized recently that github gists are always public, which makes this a bit less useful since you do not want to store any secrets/etc in the device-specific settings.

@momon I've implemented something similar at https://marketplace.visualstudio.com/items?itemName=jacobdufault.vscode-sync which uses google drive as the sync backend.

@shanalikhan - I like this approach a lot. It would really help in maintaining machine specific settings.

@jacobdufault - github gists can be private if you have a paid github account. My vs-code settings are synced to a "secret" gist.

I like it as well. Besides @beginsync and @endsync, there could also be just @sync affecting just the next line which would be by far the most common use case for me. For example:

{
    // @sync os=windows
    "window.menuBarVisibility": "toggle",

    // this one is applied on all my machines
    "window.titleBarStyle": "custom",

    // @sync host=PC
    "editor.fontSize": 12

    // @sync host=Laptop
    //"editor.fontSize": 16
}

I would also appreciate an "ignore" pragma that would make sure certain setting is simply not touched (both during upload and download):

{
    // @sync-ignore
    "window.zoomLevel": 2
}

What I mean by "not touched" is:

  • When I download settings.json that contains e.g. "window.zoomLevel": 1, it _doesn't_ overwrite my value of 2.
  • When I upload (sync > upload), the value of "window.zoomLevel" in the remote Gist is _not_ overwritten with my local value.

Duplicate of #640

Was this page helpful?
0 / 5 - 0 ratings