Blu*_*ret 7 visual-studio-code
在Visual Studio Code中,您现在可以将集成终端分成两半.我也在使用VSCode的任务功能来同时运行两个任务.如何在运行任务时将其设置为自动拆分当前终端,使用新任务完成任务?
基本上我想打开VSCode,它应该像正常一样自动打开集成终端,然后我可以运行我的两个任务,这应该以一个终端拆分为三个如此:
------------------------------------------------------
| default terminal | Task 1 | Task 2 |
------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
编辑( 已修复): VSCode已更新为允许此操作:D https://code.visualstudio.com/updates/v1_31#_task-output-support-split-terminals
您现在可以配置任务以在拆分终端面板中显示输出,而不是创建新的输出.任务配置可以使用表示部分中的组属性来定义应显示任务输出的位置.
创建任务时,请确保将presentation.reveal选项设置为always并且presentation.panel选项设置为new。这样,输出总是会显示出来,并且在每次任务运行时都会创建一个新终端
例子:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Run tests",
"type": "shell",
"command": "./scripts/test.sh",
"windows": {
"command": ".\\scripts\\test.cmd"
},
"group": "test",
"presentation": {
"reveal": "always",
"panel": "new"
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
更多信息请访问:Visual Studio Code 中的任务
编辑:由于您希望将新任务分配到拆分终端中,因此此信息可能会有所帮助。我认为这是不可能的:将任务直接启动到拆分终端
2019 年 1 月的更新中添加了对此的直接支持。
presentation.group为每个任务的属性设置相同的名称将导致任务出现在拆分终端中。从 VS 代码文档:
group:使用拆分窗格控制是否在特定终端组中执行任务。同一组中的任务(由字符串值指定)将使用拆分终端而不是新的终端面板来呈现。
以下应该工作:
{
"type": "process",
"label": "terminal",
"command": "/bin/bash", // <-- your shell here
"args": [
"-l" // login shell for bash
],
"problemMatcher": [],
"presentation": {
"echo": false, // silence "Executing task ..."
"focus": true,
"group": "sxs", // some arbitrary name for the group
"panel": "dedicated"
},
"runOptions": {
"runOn": "folderOpen"
}
}
Run Code Online (Sandbox Code Playgroud)
在这里,当文件夹在 vscode 中打开时,我将自动启动(并设置焦点)终端 - 并且共享相同的进一步任务presentation.group在运行时被放置在拆分终端中(使用新的与重用的拆分)取决于他们presentation.panel)
注意:对于此示例,您可能需要也可能不需要该-l选项,具体取决于您对 的设置terminal.integrated.shell*,terminal.integrated.automationShell*并且terminal.integrated.inheritEnv--此问题对设置 shell 环境所涉及的内容进行了一些讨论。
| 归档时间: |
|
| 查看次数: |
1413 次 |
| 最近记录: |