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

Allow to scope settings by platform #5595

Open
jarod51 opened this issue Apr 21, 2016 · 155 comments
Open

Allow to scope settings by platform #5595

jarod51 opened this issue Apr 21, 2016 · 155 comments
Assignees
Labels
config VS Code configuration, set up issues feature-request Request for new features or functionality settings-sync
Milestone

Comments

@jarod51
Copy link

jarod51 commented Apr 21, 2016

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)

@dbaeumer dbaeumer added this to the Backlog milestone Apr 21, 2016
@dbaeumer
Copy link
Member

@bpasero, @aeschli FYI.

@dbaeumer dbaeumer added the feature-request Request for new features or functionality label Apr 21, 2016
@bpasero bpasero changed the title Per platform settings Allow to scope settings by platform Apr 21, 2016
@bpasero bpasero self-assigned this Apr 21, 2016
@bpasero
Copy link
Member

bpasero commented Jul 15, 2016

#8962

@bpasero bpasero closed this as completed Jul 15, 2016
@bpasero bpasero added the *duplicate Issue identified as a duplicate of another issue(s) label Jul 15, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
@Tyriar Tyriar added config VS Code configuration, set up issues and removed *duplicate Issue identified as a duplicate of another issue(s) labels Aug 15, 2018
@microsoft microsoft unlocked this conversation Aug 15, 2018
@Tyriar Tyriar reopened this Aug 15, 2018
@Tyriar
Copy link
Member

Tyriar commented Aug 15, 2018

#8962 is about keybindings, not settings

@sandy081
Copy link
Member

Planning for October to Kickoff

@sandy081 sandy081 modified the milestones: October 2018, Backlog Oct 29, 2018
@gueggel
Copy link

gueggel commented Oct 14, 2023

Any news? This would be a great and really helpful feature.

@pouyarezvani
Copy link

Just use Intelij guys 😁

@philipbel
Copy link

Well, it's been 7 years, 5 months and 25 days since this issue was posted.

@ievgennaida
Copy link

Would be nice to have python venv based on envrionment:
"python.defaultInterpreterPath": "~/venv/bin/python"

@TryerGit
Copy link

TryerGit commented Oct 22, 2023

This will be a huge time saver and boost to productivity. Settings sync does not solve the issue. See stackoverflow discussion on that here

Currently, I have to manually manage the following various versions of settings.json:

Windows Machine 1:

    "hsnips.hsnipsPath": "C:\\Users\\TryerGitOne\\AppData\\Roaming\\Code\\User\\hsnips",

Windows Machine 1, WSL: 

    "hsnips.hsnipsPath": "/mnt/c/users/TryerGitOne/AppData/Roaming/Code/User/hsnips",

Windows Machine 1:

    "vim.neovimPath": "C:\\Users\\TryerGitOne\\Downloads\\nvim-win64\\Neovim\\bin\\nvim.exe",
    "vim.vimrc.path": "C:\\Users\\TryerGitOne\\.vimrc",
    "hsnips.hsnipsPath": "C:\\Users\\TryerGitOne\\AppData\\Roaming\\Code\\User\\hsnips",

Linux: 

    "vim.neovimPath": "/usr/bin/nvim",
    "vim.vimrc.path": "/home/TryerGitOne/GoogleDrive/research_programming/Setup Folder/VSIDE Stuff/.vimrc",
    "hsnips.hsnipsPath": "~/.config/Code/User/hsnips",

Windows Machine 1:

    "vim.neovimPath": "C:\\Users\\TryerGitOne\\Downloads\\nvim-win64\\Neovim\\bin\\nvim.exe",
    "vim.vimrc.path": "C:\\Users\\TryerGitOne\\.vimrc",
    "hsnips.hsnipsPath": "C:\\Users\\TryerGitOne\\AppData\\Roaming\\Code\\User\\hsnips",

Windows Machine 2:

    "vim.neovimPath": "C:\\Users\\TryerGitTwo\\Downloads\\nvim-win64\\bin\\nvim.exe",
    "vim.vimrc.path": "C:\\Users\\TryerGitTwo\\.vimrc",
    "hsnips.hsnipsPath": "C:\\Users\\TryerGitTwo\\AppData\\Roaming\\Code\\User\\hsnips",
Windows Machine 1:

    "vim.neovimPath": "C:\\Users\\TryerGitOne\\Downloads\\nvim-win64\\Neovim\\bin\\nvim.exe",
    "vim.vimrc.path": "C:\\Users\\TryerGitOne\\.vimrc",
    "hsnips.hsnipsPath": "C:\\Users\\TryerGitOne\\AppData\\Roaming\\Code\\User\\hsnips",

Windows Machine 2, WSL: 

    "vim.neovimPath": "C:\\Users\\TryerGitTwo\\Downloads\\nvim-win64\\bin\\nvim.exe",
    "vim.vimrc.path": "C:\\Users\\TryerGitTwo\\.vimrc",
    "hsnips.hsnipsPath": "/mnt/c/users/TryerGitTwo/AppData/Roaming/Code/User/hsnips",

You can easily see the combinatorial madness. Many of these machines (even Windows machines) are official machines where the user does not have the option of providing the same username as all other machines so that the directory paths may be the same.

Vim already provides for this in .vimrc. Here is an example from my single .vimrc where based on running a shell command (query present working directory), one can figure out which machine mount one is on:

let g:machine_run_on_wsloffice = system("pwd | grep -c '/mnt/e'")
let g:machine_run_on_wslhome = system("pwd | grep -c '/mnt/c'")
if g:machine_run_on_wsloffice == 1
  set viminfo=%,<800,'100,/50,:100,f1,n./.vim/.viminfooffice
else
  if g:machine_run_on_wslhome == 1
    set viminfo=%,<800,'100,/50,:100,f1,n./.vim/.viminfohome
  else
    set viminfo=%,<800,'100,/50,:100,f1,n./.vim/.viminfoubuntu
  endif
endif

So, there is no need to have a different .vimrc for different machine. As others have pointed out, CMake has support for something similar also.

@tn-072
Copy link

tn-072 commented Dec 26, 2023

What about this:

{
    // ...
    "[sys:win]": {
            "python.defaultInterpreterPath": "<my python path on windows>",
    },
    "[sys:linux]": {
            "python.defaultInterpreterPath": "<my python path on linux>",
    },
    "[sys:osx]": {
            "python.defaultInterpreterPath": "<my python path on Mac>"
    },
    // ...
}

which uses similar syntax like language-specific settings:

{
    // ...
    "[cpp]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd",
    },
    // ...
}

@sdholden
Copy link

Some sort of solution is long overdue...any progress?

@buzcarter
Copy link

I'll second @tn-072 's suggestion.

{
    "editor.fontSize": 14,
    "python.pythonPath": "/usr/local/bin/python3",
    "[windows]": {
        "editor.fontSize": 16,
        "python.pythonPath": "C:\\Python39\\python.exe"
    },
    "[mac]": {
        "editor.fontSize": 18,
        "python.pythonPath": "/usr/local/bin/python3"
    },
    // ... the shared bits
}

@sanmai-NL
Copy link

Instead of scoping by 'platform' I suggest to scope by user-defined tag(s), to support use cases where the same OS is used for different purposes (e.g. work Linux, personal Linux) beyond what profiles can offer.

@heartacker
Copy link
Contributor

Instead of scoping by 'platform' I suggest to scope by user-defined tag(s), to support use cases where the same OS is used for different purposes (e.g. work Linux, personal Linux) beyond what profiles can offer.

What you say is profile

@sanmai-NL
Copy link

sanmai-NL commented Jan 9, 2024

Then all combinations of language, macOS/Linux/Windows, work/personal would need to be separate profiles.

@starball5
Copy link

starball5 commented Jan 9, 2024

I ctrl+f-ed for "profile" and several times when the profiles approach came up in past discussion, it was dismissed because at the time, it required creating a standalone copy of settings, and there was no way to inherit from the default. For those people, see #156144, which as released in July 2023. I'm not saying this is the solution. I'm just saying it may be more attractive as a workaround than it had been previously.

@jd-solanki
Copy link

Why it's still in backlog?

@pfeerick
Copy link

pfeerick commented Jun 6, 2024

I'd love to see this feature for the some of the above reasons such as OS and path specific differences, but also because I set the new option

"terminal.integrated.middleClickBehavior": "paste"

which works great on Windows, but on Linux (which picks up the setting because I have Settings Sync enabled), it makes it paste the clipboard content + selection rather than just the selection, so I've had to set it back to default now. 🤣

@starball5
Copy link

@pfeerick oh interesting. Are you aware of "editor.selectionClipboard": false,? See also https://stackoverflow.com/q/36723333/11107541

@Poikilos
Copy link

Then all combinations of language, macOS/Linux/Windows, work/personal would need to be separate profiles.

If you have a work and personal account on your linux/macOS/Windows machine, that is 6 accounts. If you need it that fine-grained, you could already just put the setting in your user profile. It isn't directly related to this. There is no way to detect if you are work or personal...that is a user-level abstract distinction.

@pfeerick
Copy link

@pfeerick oh interesting. Are you aware of "editor.selectionClipboard": false,? See also

No I wasn't... thanks for that!. It fixes the "double" paste (one from selection, one from clipboard), but does mean you must use the clipboard if using middleClickBehavior": "paste", so still not ideal. Spotted terminal.integrated.copyOnSelection as well though which I didn't know about... that would work if just working with terminal, and not wanting to mix editor and terminal.

@alexchexes
Copy link

alexchexes commented Jun 18, 2024

In the meantime (the discussion has lasted 8 years and doesn't seem to be progressing), how do you all set a comfortable font when switching machines? On my MacBook, I'm good with a 12px font, but on my Windows machine, I need at least 14px. What do you do in such cases (when Settings Sync is On)?

@sanmai-NL
Copy link

You can use settings profiles nowadays. Maybe you can template them?

@alexchexes
Copy link

@sanmai-NL
Could you please provide a bit more detail about your suggestion? I checked out the VSCode documentation, but it seems that templates refer to a predefined set of configurations used for different programming languages or common environments. Not sure how I could use that to keep all my settings in sync while having different font sizes on Mac and Windows...

@sanmai-NL
Copy link

I mean templating VS Code settings with an external tool, and putting the per-OS outputs in a dotfiles repository.

@hermes85pl
Copy link

What do you do in such cases (when Settings Sync is On)?

@alexchexes, one solution would be to treat such settings as device-specific and put them under settingsSync.ignoredSettings.

@iwangbowen
Copy link

Any updates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config VS Code configuration, set up issues feature-request Request for new features or functionality settings-sync
Projects
None yet
Development

No branches or pull requests