shanalikhan / code-settings-sync

🌴💪 Synchronize your Visual Studio Code Settings Across Multiple Machines using GitHub GIST 💪🌴
https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync
MIT License
4.02k stars 390 forks source link

Feature Request: sync pragma conditional blocks #1062

Open daisy-develops opened 5 years ago

daisy-develops commented 5 years ago

I like being able to keep things between my Mac and Windows separated using the sync pragma, but it would be even better if we could do something like:

// @sync if os=windows
"editor.fontFamily": "Fira Code Retina",
"terminal.integrated.fontFamily": "Consolas"
// @sync endIf

Or // @syncIf and // @end like this other settings sync extension: https://github.com/jacobdufault/vscode-sync

shanalikhan commented 5 years ago

Nice idea! @protium-dev can assist us on this :)

shanalikhan commented 5 years ago

@daisy-develops

If your scenario is limited to os related settings. Look here: https://github.com/shanalikhan/code-settings-sync/wiki/Sync-Pragmas#per-os

Let me know if it helps,

daisy-develops commented 5 years ago

@shanalikhan Hi! It's just my immediate use case because I haven't configured for hosts, however, the example for host still illustrates the limitation:

// settings.json on "home" computer running Linux

{
  // @sync host=home os=linux
  "window.zoomLevel": "1",
  // @sync host=work os=windows
  // "window.zoomLevel": "0",
}

// settings.json on "work" computer running Windows

{
  // @sync host=home os=linux
  // "window.zoomLevel": "1",
  // @sync host=work os=windows
  "window.zoomLevel": "0",
}

I can only have one setting per @sync pragma. What if I had another setting that I wanted to be different between the two?

{
  @sync host=home os=linux
  "window.zoomLevel": "1",
  "some.other.setting": "some special value for linux@home", // this is going to go to everything that syncs these settings
  @sync host=work os=windows
  "window.zoomLevel": "0",
  "some.other.setting": "some special value for windows@work", // this is going to go to everything and possibly override the other one (bad news for linux@home)
}

This is what has prompted me to make the feature request:

    // @sync os=mac
    // "editor.fontFamily": "FiraCode-Retina",
    // @sync os=windows
    "editor.fontFamily": "Fira Code Retina",
    // @sync os=windows
    "terminal.integrated.fontFamily": "Consolas",

Fira Code Retina looks terrible in my Windows terminal, so I need to set it back to the one I like. It would be really convenient to be able to specify more than one setting per pragma.

shanalikhan commented 5 years ago

This is what has prompted me to make the feature request:

@daisy-develops so you are saying that without host // @sync os=mac doesn't simply work?

Have you tried it? If it doesnt work with simple // @sync os=mac then it should be taken as a bug. Let me know about your findings.