【发布时间】:2021-10-24 06:19:36
【问题描述】:
有几个与重命名或设置终端配置文件有关的问题:
但是如果你想通过 settings.json 每个文件夹来定义这个,你会怎么做呢?
【问题讨论】:
标签: vscode-settings
有几个与重命名或设置终端配置文件有关的问题:
但是如果你想通过 settings.json 每个文件夹来定义这个,你会怎么做呢?
【问题讨论】:
标签: vscode-settings
答案是只能为工作区做。
Workspace.code-workspace 例如:
{
"settings": {
"powershell.powerShellDefaultVersion": "PowerShell (x64)",
"python.envFile": "${workspaceFolder}/.venv",
"terminal.integrated.profiles.windows": {
"myprofilename": {
"source": "PowerShell",
"overrideName": true,
"icon": "terminal-powershell"
}
}
}
}
这将创建myprofilename 作为新终端选项的选择。
但是,如果您想在多根工作区中设置默认值,请在文件夹级别:
例如:somefolder_in_workspace/.vscode/settings.json:
{
"terminal.integrated.defaultProfile.windows": "myprofilename"
}
如果您将鼠标悬停,您会看到一条灰色的线:This setting cannot be applied in this workspace. It will be applied when you open the containing workspace folder directly.
这是文档解释行为的方式:
为避免设置冲突,使用多根工作区时仅应用资源(文件、文件夹)设置。影响整个编辑器的设置(例如 UI 布局)将被忽略。例如,两个项目不能同时设置缩放级别。
所以答案是否,对于多根工作区中的文件夹,但是,如果您想要工作区终端的名称
【讨论】:
.vscode/settings.json 在多根目录中的每个文件夹:只有当您站在为该特定文件夹打开的文件上时才会应用它。