I want to put my User Settings file under version control, preferably a separate folder, but I can't find the option to tell VSCode where my settings file is located.
Is there a way to change the location that Visual Studio Code looks for the settings.json
file?
Update:
Since there does not seem to be a easy way to change the default location of the user settings file, besides passing the command line arguments as in this answer, I went with a different approach.
I created a git repository which contains all of my dotfiles, settings-files, etc. and put my settings.json
there. This repository is cloned somewhere on the development partition of my hard drive. I then created a Symlink using the mklink.exe
tool (I am on Windows) to the settings file in my repository in the default user settings directory (path-to-user/AppData/Roaming/Code/User/
on Windows). The only drawback is that you can't move the repository, or change its layout without having to recreate the link.
Changing the Symlink to a Hardlink is not advised as explained in this blog-post. Also Hardlinks seem to mess up the timestamps on Windows, so you won't see any changes made to settings.json
from within VSCode. The Symlink seems to be working tho.
The workspace settings file is located under the . vscode folder in your project.
To open the Settings editor, use the following VS Code menu command: On Windows/Linux - File > Preferences > Settings. On macOS - Code > Preferences > Settings.
code-workspace all that is needed is to go to File->Save Workspace As..., browse to the new location, select the name you want to give the workspace and it will save it with a . code-workspace extension. All of the "path" entries in the "folders" section are changed to a path relative to the new location.
You can set the location of the global user data folder by launching from the command line with the --user-data-dir
option. But I just initialized a git repo in the default user settings location and keep it in source control there.
You can add a settings file for a workspace like this :
/yourproject/.vscode/settings.json
Or use the editor and goto :Preferences->settings
and select workspace settings in the top bar.
These can be checked into your project and then to source control.
Reference : https://code.visualstudio.com/docs/getstarted/settings#_creating-user-and-workspace-settings
The file is created for you by default when editing the settings in your workspace. There you can select User or Workspace settings.
You can also open the Settings editor from the Command Palette (⇧⌘P) with Preferences: Open Settings or use the keyboard shortcut (⌘,).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With