Same VSCode-Settings for the whole crew?
Asked Answered
S

4

6

We want to have the same VSCode settings for the whole crew of developers. Also it would be fine to have a oneline command to tear VSCode down and restart it from scratch with predefined settings and plugins so that you do not have to worry about trying out plugins and getting beck to the known state. Kind of Config-as-Code for VSCode.

I already found:

But non of these provides a good solution to me

We are using Mac and Windows machines and develop most of the time locally (not remotely in the cloud or the like).

I imagine like having a script like

.... projectname up

or

.... projectname reset

(or

.... projectname down)

to receive/reset the configured settings and newest plugins that have been configured for the project.

Have any ideas or use a similar solution already?

Selfhood answered 3/6, 2019 at 14:54 Comment(0)
S
1

After doing a lot of research, playing with Docker, Ansible and so on... it seems that although I excluded it at first the plugin Settings Sync Plugin from Shan Khan is the way to go. It has round about 1 million installs!

Only dependency - you need a GitHub account to host your configs. That is what held me back at first - but it should be not that much of a problem to get one for everyone in the team and connect it to like a company-github-account.

Selfhood answered 26/7, 2019 at 6:37 Comment(1)
This plugin is now deprecated.Dilatory
V
1

Copy the files settings.json and keybindings.json to your target machine(s) to copy the settings. You can find those files here:

  • Win: ~\AppData\Roaming\Code\User
  • Mac: ~/Library/Application Support/Code/User/
  • Linux: ~/.config/Code/User

You can copy extentions from ~/.vscode/extensions or C:\Users\username\.vscode\extensions from linux/mac or windows respectively.

Vanillin answered 1/7, 2019 at 13:46 Comment(1)
Interesting discovery. However, I saw that if I propagate the file C:\Users\username\.vscode\extensions (via a script), VS Code won't load those extensions.Dilatory
S
1

After doing a lot of research, playing with Docker, Ansible and so on... it seems that although I excluded it at first the plugin Settings Sync Plugin from Shan Khan is the way to go. It has round about 1 million installs!

Only dependency - you need a GitHub account to host your configs. That is what held me back at first - but it should be not that much of a problem to get one for everyone in the team and connect it to like a company-github-account.

Selfhood answered 26/7, 2019 at 6:37 Comment(1)
This plugin is now deprecated.Dilatory
S
0

FalcoGer's answer should explain how to copy the files in a way VS Code will pick them up. If you only need to copy the config files once, this solution would be fine.

If you need to "sync" these config files on a regular basis, I would advise to create a Git repository where all config files will be stored.

When cloning the repo to local machines, you can symlink the files to the config destinations (see FalcoGer's anwser). Then when you need to "sync", you only have to run git pull and restart VS Code to apply the changes.

For your other script-related question, you could create a CLI for this. Python would be the most friendly way to do this. You can find an example here.

Sandstrom answered 6/7, 2019 at 11:2 Comment(0)
D
0

The simplest solution that we compiled based on what we found on Internet, is the following:

On each PC, in the file .vscode-server/server-env-setup:

# Cf. https://code.visualstudio.com/docs/remote/wsl#_advanced-environment-setup-script, this runs command(s)
# when the code server starts (in WSL). We say practically always: please install these extensions ...
# * if the extensions don't exist, they are of course installed (the mode 'installed in wsl', not the mode 'installed in win')
# * if they exist, nothing will be done; and this is fast; i.e. the startup time of vscode is not being penalized
# 
# Others on Internet had more complex scripts; but their complexity doesn't seem to be needed.
/mnt/c/Program\ Files/Microsoft\ VS\ Code/bin/code --install-extension eamodio.gitlens
...

How to propagate this file on each PC? This is up to the tool you use in your org. We use Salt Stack.

Dilatory answered 2/8 at 16:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.