Allow to scope settings by platform
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)
@bpasero, @aeschli FYI.
https://github.com/Microsoft/vscode/issues/8962
#8962 is about keybindings, not settings
Planning for October to Kickoff
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 it got pushed out unfortunately, the issue will be closed with a milestone set (the version it'll land in) when it's done.
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?
When will this feature release?
When will this feature release? [2]
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.
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 Can you please give me the example of those settings?
@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.
@sandy081 https://github.com/Microsoft/vscode/issues/17619 describes it perfectly: the pathes differ on Windows, Linux and macOS.
@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.
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 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"
},
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).
@jonnyasmar for illustration only.
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