vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Allow to scope settings by platform

Open arnaud-lecat opened this issue 10 years ago • 187 comments

Hi

I develop on 3 different platform. When synchronizing settings, snippets and so on, i often must change path, adjust font-size, etc...

So, it could be great if we had a per platform settings set (Windows, Mac, Unix)

arnaud-lecat avatar Apr 21 '16 09:04 arnaud-lecat

@bpasero, @aeschli FYI.

dbaeumer avatar Apr 21 '16 10:04 dbaeumer

https://github.com/Microsoft/vscode/issues/8962

bpasero avatar Jul 15 '16 07:07 bpasero

#8962 is about keybindings, not settings

Tyriar avatar Aug 15 '18 14:08 Tyriar

Planning for October to Kickoff

sandy081 avatar Oct 24 '18 06:10 sandy081

Did this happen? I'd like to consolidate my VSCode settings.json. Great job on the editor, by the way. It's really been a help to me, and the mix of intuitiveness and power makes it easy to recommend to new programmers.

bbkane avatar Dec 12 '18 23:12 bbkane

@bbkane it got pushed out unfortunately, the issue will be closed with a milestone set (the version it'll land in) when it's done.

Tyriar avatar Dec 13 '18 16:12 Tyriar

I know you are working hard on all kind of nice features, still, is there any updates on when this might get a new milestone/target release?

thernstig avatar Jan 22 '19 12:01 thernstig

When will this feature release?

chparimi avatar Jan 30 '19 01:01 chparimi

When will this feature release? [2]

alanlivio avatar Jan 30 '19 10:01 alanlivio

Its still under discussion, one approach we are thinking is to support Machine specific settings rather than Platform specific. Because most of these settings are path related and they are scoped to a machine rather to platform.

sandy081 avatar Jan 30 '19 11:01 sandy081

Plattform specific > machine specific I want to place settings on a cloud drive and access it from various machines. In that scenario I would barely benefit from machine specific.

chris400 avatar Jan 30 '19 11:01 chris400

@chris400 Can you please give me the example of those settings?

sandy081 avatar Jan 30 '19 14:01 sandy081

@sandy081 For example, I would like to be able to use a different font on Windows vs Mac OS. Or on Linux I want to use the native title-bar.

I am using the Setting Sync extension so it would be useful if I could share one configuration across all my machines.

eberkund avatar Jan 30 '19 16:01 eberkund

@sandy081 https://github.com/Microsoft/vscode/issues/17619 describes it perfectly: the pathes differ on Windows, Linux and macOS.

chris400 avatar Jan 30 '19 17:01 chris400

@sandy081 There are other settings besides paths, fonts etc. that one might want different per OS. For example "keyboard.dispatch"

I also think settings per OS also fits better since keyboard settings and launch configs have support per OS. So making the normal settings also be per OS would fit better in that sense.

thernstig avatar Jan 30 '19 22:01 thernstig

There is language specific settings, which allows the following:

{
  "[typescript]": {
    "editor.formatOnSave": true,
    "editor.formatOnPaste": true
  },
  "[markdown]": {
    "editor.formatOnSave": true,
    "editor.wordwrap": "on",
    "editor.renderWhitespace": "all",
    "editor.acceptSuggestionOnEnter": false
  }
}

I suggest to follow up this and allow something like:

{
  "[[osx]]": {
    "editor.fontSize": 13,
    "terminal.integrated.fontSize": 13,
    "markdown.preview.fontSize": 13,
    "restructuredtext.preview.fontSize": 13
  },

  "{windows}": {
    "editor.fontSize": 12,
    "terminal.integrated.fontSize": 12,
    "markdown.preview.fontSize": 12,
    "restructuredtext.preview.fontSize": 12
  },

  "(linux)": {
    "editor.fontSize": 11,
    "terminal.integrated.fontSize": 11,
    "markdown.preview.fontSize": 11,
    "restructuredtext.preview.fontSize": 11
  },

  "editor.fontSize": 12,
  "terminal.integrated.fontSize": 12,
  "markdown.preview.fontSize": 12,
  "restructuredtext.preview.fontSize": 12
}

FelikZ avatar Feb 20 '19 16:02 FelikZ

@FelikZ Is there a reason you formatted osx, windows, & linux keys differently? Or just illustrating possibilities? I think single brackets are most consistent: [windows]

@sandy081 Platform & machine specific would be great. I'm assuming some pattern like this?

"[windows]: {
  "editor.fontSize": 13,
},
"[Jonny-PC]": {
  "local-history.path": "c:\dev\.vscode",
}

One additional consideration is that terminal.integrated.shell (maybe others?) follows a divergent pattern:

"terminal.integrated.shell.osx": "zsh",
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\wsl.exe"

If platform specific settings become an option, this should probably be adjusted to follow the same pattern:

"[osx]: {
  "terminal.integrated.shell": "zsh",
},
"[windows]: {
  "terminal.integrated.shell": "C:\\WINDOWS\\System32\\wsl.exe"
},

jonnyasmar avatar Mar 03 '19 17:03 jonnyasmar

I like the idea of using [] to represent conditions in JSON. Because [language] is already being used as a specialization option, we should consider guarding other names (I'm using sub-maps and the "platform" namespace below"). I also think it would be nice to make the override order explicit.

A theoretical example extending the namespacing with a new key platform and use maps inside to specialize:

{
  // settings later in the list override settings earlier in the list
  "settingsOverrideOrder": [
    "default",           // stuff in settings.json not in a [condition] specialization
    "platform.os",       // settings.json in the "platform.os" map
    "platform.hostname", // settings.json in the "platform.hostnames" map
    "language",          // stuff in the "[lang]" maps
    "project"            // stuff in .vscode/settings.json

  ],

  // We can't do a "language" map cause we need backwards compatibility
  "[elm]": {
    "editor.formatOnSave": true,
  },

  "[platform.os]": {
    "osx": {
      "editor.formatOnSave": true,
    }
  },

  "[platform.hostname]": {
    "mac01": {
      "editor.formatOnSave": true,
    },
    "lin01": {
      "editor.formatOnSave": true,
    }
  },

}

Notes

Instead of scoping by dictionary, we could scope specializations with dots more. This would result in the "hostname" key having dynamically scoped names, which is not great... but it would reduce nesting.

"[platform.os.osx]": ...
"[platform.hostname.mac01]" ... // ewww...

We can't have a "[language]": { "elm": ... } specialization because that breaks backwards compatibility. Languages are already represented in "[lang-name]".


There's probably better names for a lot of this stuff... "osx" vs "darwin", "settingsOverrideOrder".

"hostname" vs "machineName" vs some other machine identifier (MAC address, IP, ...)


I'm namespacing new non-language specializations with dots to avoid language name conflicts (hope there's not a new language named "platform")


I'm introducing "settingsOverrideOrder" because I think the user might want to decide override order (particularly in regards to where language fits in).

bbkane avatar Mar 05 '19 01:03 bbkane

@jonnyasmar for illustration only.

FelikZ avatar Mar 05 '19 08:03 FelikZ

I work at Oculus/Facebook and this might be the only feature missing for us to start using VSCode heavily

The proposal

"[platform.os.osx]": ... "[platform.hostname.mac01]" ...

or some regex around it might be fantastic

walter-erquinigo avatar Mar 15 '19 03:03 walter-erquinigo