Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per-platform / per-hostname inline settings #555

Closed
jacobdufault opened this issue May 21, 2018 · 7 comments
Closed

Per-platform / per-hostname inline settings #555

jacobdufault opened this issue May 21, 2018 · 7 comments

Comments

@jacobdufault
Copy link

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.

@shanalikhan
Copy link
Owner

shanalikhan commented May 21, 2018

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.

@momon
Copy link

momon commented May 22, 2018

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.

@jacobdufault
Copy link
Author

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.

@jacobdufault
Copy link
Author

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

@robertpeteuil
Copy link

@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.

@borekb
Copy link

borekb commented Sep 4, 2018

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.

@shanalikhan
Copy link
Owner

Duplicate of #640

@shanalikhan shanalikhan marked this as a duplicate of #640 Sep 13, 2018
Repository owner locked and limited conversation to collaborators Sep 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants