【发布时间】:2022-03-15 20:14:02
【问题描述】:
【问题讨论】:
-
你的意思是like this?
-
@TimothyG。没错,我确实更新了我的问题
【问题讨论】:
如果有人仍然感兴趣,可以这样做。 至少现在您可以在扩展设置中指定终端的配置文件:
"restoreTerminals.terminals": [
{
"profile": "Coverage",
"splitTerminals": [
{
"name": "Coverage",
}
]
},
{
"profile": "Server",
"splitTerminals": [
{
"name": "Server",
}
]
}
]
因此,您实际上可以像这样为每个终端创建配置文件:
"terminal.integrated.profiles.windows": {
"Coverage": {
"path": ["D:\\Program Files\\Git\\bin\\bash.exe"],
"icon": "beaker",
"color": "terminal.ansiGreen"
},
"Server": {
"path": ["D:\\Program Files\\Git\\bin\\bash.exe"],
"icon": "server",
"color": "terminal.ansiMagenta"
}
},
然后完成: Terminals
【讨论】:
在您的 settings.json 文件中,您可以指定配置文件中图标的icon 和color。例如:
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash",
"icon": "terminal-bash", //what icon to use
"color": "terminal.ansiGreen" //color of icon
}
},
"terminal.integrated.defaultProfile.windows": "Git Bash",
使用您链接到的扩展会产生这样的结果(使用他们在扩展文档中列出的示例 json 设置):
看起来扩展使用你的默认终端配置文件(实际上查看它的源代码,它甚至不知道它的默认配置文件,只是调用VS Code API commands to spawn new terminals),并应用所述配置文件的设置,因此您只能使用一种颜色/图标。
【讨论】:
,我的问题的目的是能够更改每个图标和颜色,api 应该是黄色,云蓝色,....我确实更新了我的问题,以更准确地说明我尝试归档的内容。
如果可行,那将不是 VSCode 本身,而是通过扩展。
“在创建时将唯一/随机颜色/图标分配给终端选项卡”(microsoft/vscode issue 127951)很明确:
作为扩展关闭可以做到
OP 补充说:
要使其可行,我们首先需要了解如何通过 api 更改颜色
这之后是issue 128228,并在PR 130123 "Finalize terminal color API"中实现
【讨论】: