Isa*_*eur 15 terminal startup visual-studio-code
是否可以将用户设置配置为在打开 Visual Studio Code 时自动启动集成终端?
Eth*_* SK 14
现在有一个扩展可以让您在启动时设置终端,甚至可以使用拆分终端视图!
https://marketplace.visualstudio.com/items?itemName=EthanSK.restore-terminals
ps是我写的
从 VS Code v1.45.0 开始,另一个答案中提到的实验配置现在应该是 VS Code 的默认行为。只需确保将您的文件/文件夹保存在工作区中。请参阅什么是 VS Code“工作区”?VS Code 文档的部分。
VS Code 会记住工作区的最后状态并恢复它。如果我在关闭窗口之前打开了集成终端面板,则在我重新加载或重新打开工作区时它会重新打开(尽管我似乎找不到此设置)。所以基本上,集成终端已经自动显示了。(我使用 Ubuntu 18 和 macOS 10.15。)
如果您有特定的终端设置(例如,多个终端打开到不同的目录、python 环境、工作区等),您可以查看终端管理器,它用于“一次设置多个终端”并且可以配置为自动-在启动时运行。
你只需要在你的工作区中(在.vscode下)添加一个terminal.json文件,并设置为. 这将自动运行扩展的终端:启动时运行命令以自动加载您的终端。autoruntrue
{
"autorun": true,
"autokill": true,
"terminals": [
{
"name": "GIT",
"description": "For running git commands",
"open": true,
"focus": true,
"commands": [
"pwd",
"git fetch -v"
]
},
{
"name": "BUILD",
"description": "For running build commands",
"open": true,
"focus": false,
"commands": [
"cd apps",
"./clean.sh"
]
},
{
"name": "SCRIPTS",
"description": "For running python commands",
"open": true,
"focus": false,
"commands": [
"source $VENV_DIR/test-py38/bin/activate",
"python -V"
]
},
]
}
Run Code Online (Sandbox Code Playgroud)
小智 7
以下对我有用:
// 启动 VS Code 时是否自动恢复工作区的终端会话。这是一个实验设置;它可能有问题并且将来可能会改变。
将以下内容粘贴到您的用户设置中:
“terminal.integrated.experimentalRestore”:true
| 归档时间: |
|
| 查看次数: |
7088 次 |
| 最近记录: |