Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change VSCode User Settings location

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.

like image 964
Luca Fülbier Avatar asked Jun 15 '17 19:06

Luca Fülbier


People also ask

Where are VSCode user settings stored?

The workspace settings file is located under the . vscode folder in your project.

How do I change my user settings in VS code?

To open the Settings editor, use the following VS Code menu command: On Windows/Linux - File > Preferences > Settings. On macOS - Code > Preferences > Settings.

How do I change my workspace location in VSCode?

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.


2 Answers

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.

like image 91
Rob Lourens Avatar answered Oct 06 '22 03:10

Rob Lourens


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 (⌘,).

enter image description here

like image 34
corn3lius Avatar answered Oct 06 '22 01:10

corn3lius