更改 VSCode 用户设置位置 [英] Change VSCode User Settings location

查看:56
本文介绍了更改 VSCode 用户设置位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的用户设置文件置于版本控制之下,最好是一个单独的文件夹,但我找不到告诉 VSCode 我的设置文件所在位置的选项.

是否可以更改 Visual Studio Code 查找 settings.json 文件的位置?

更新:

因为除了像

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.

解决方案

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

这篇关于更改 VSCode 用户设置位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆