英文:
How do I launch/debug a project in an external console?
问题
我正在尝试在VSCode中调试一个Go项目。我能够进行调试,但应用程序在内部的VSCode终端中运行。我希望应用程序在外部控制台中运行,例如在cmd.exe中运行。
你可以通过修改launch.json文件来实现在外部控制台中运行调试会话,而不是在VSCode的内部控制台中运行。你可以按照以下步骤进行操作:
- 打开项目中的.vscode文件夹。
- 打开launch.json文件。
- 在configurations数组中的"Launch Package"对象中添加一个新的属性"console",并将其值设置为"externalTerminal",如下所示:
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"console": "externalTerminal"
}
- 保存launch.json文件。
这样,当你进行调试时,调试会话将在外部控制台中打开并运行。
希望对你有帮助!如果你还有其他问题,请随时问我。
英文:
I am trying to debug a Go project in VSCode. I am able to debug it, but the application is running in the internal VSCode terminal. I need the application to run in an external console instead. For instance I want it to run in cmd.exe.
// .vscode/launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}"
}
]
}
How can I make the debug session open a external console and run it there, rather than in the internal console of VSCode?
答案1
得分: 0
Go VSCode扩展的开发人员正在添加一个启动属性。请参阅:https://github.com/golang/vscode-go/issues/124#issuecomment-1006122877
英文:
The developers for the Go VSCode extension are in the process of adding a launch property for this. See: https://github.com/golang/vscode-go/issues/124#issuecomment-1006122877
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论