我正试图在VSCode中调试一个Go项目。我能够调试它,但是应用程序运行在内部的VSCode终端中。我需要应用程序在外部控制台中运行。例如,我希望它在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/?l
例如,如果我在集成的vscode终端中运行此代码:
for i in range(2):
a = input()
print(a)
我粘贴了以下内容:
a
b
控制台将显示:
a
a
b
b
我希望控制台显示(不更改代码):
a
b
a
b
注意:以上是从linux终端或空闲运行python脚本时的典型行为,但不是在vscode中。我认为问题出在vscode控制台没有缓冲打印。
从昨天对1.47.0的更新开始,当VSCode启动时,它在终端中给出了这个输出(没有后续的提示符,它允许我键入):
Debugger listening on ws://127.0.0.1:55430/f3f20387-0605-4a39-b807-77f02bea362f
For help, see: https://nodejs.org/en/docs/inspector
我通常的做法是:
使用WSL导航到我要打开的项目目录,并键入code .
然后,我将在VSCode终端(bash)中通过键入npm run serve (package.json has "serve