我已经使用VS Code很长一段时间了,就在今天我开始遇到这个奇怪的问题。以前如果我开始调试程序(F5),它将开始调试并在“调试控制台”中显示输出:
但现在它在“终端”启动调试器 并输出到“Debug Console”。
这是我的 launch.json :
{
"version": "0.2.0",
"configurations": [{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}"
}
]
}
我想在“Debug Console”中输出 only (以前的默认行为)。请帮我把它恢复原状。
答案 0 :(得分:22)
与python扩展的release 2019.4.0一样,现在可以将sizeof(float)=4, sizeof(double)=8
OK: float binary form (compile time division): fa=00E0BB45, fb=00E8BB45
OK: float binary form (NOT compile time division): fa1=00E0BB45, fb1=00E8BB45
NOT OK: double binary form (compile time division): da=00000000007CB740, db=FFFFFFFFFF7CB740
OK: double binary form (NOT compile time division):da1=00000000007CB740, db1=00000000007DB740
incorrect values:
printf(int) compile time division, literal: a=6012, b=6012
printf(float) compile time division, literal: a=6012.000000000000000, b=6012.999999999999091
printf(double) compile time division: da=6012.000000000000000, db=6012.999999999999091
correct values:
printf(int) compile time division, literal with cast: a=6012, b=6013
printf(float) compile time division, literal with cast: a=6012.000000000000000, b=6013.000000000000000
printf(float) compile time division: fa=6012.000000000000000, fb=6013.000000000000000
printf(float) NOT compile time division: fa1=6012.000000000000000, fb1=6013.000000000000000
printf(double) NOT compile time division: da1=6012.000000000000000, db1=6013.000000000000000
选项设置为console
(#4321)。
根据omartin2010's answer的建议,您还可以设置选项
internalConsole
在开始调试时自动打开调试控制台。
将console选项明确设置为"internalConsoleOptions": "openOnSessionStart"
是可行的方法。见评论。
none
要确保将输出写入调试控制台,您可以设置debugOptions。
在"console": "none"
中将以下条目添加到您的配置中应修复它:
launch.json
答案 1 :(得分:8)
我遇到了同样的问题,但我通过在顶部添加一个看起来像这样的新配置来解决它:
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "none"
},
我发现这是一个更好的解决方案,因为我没有必要更改我的其他调试功能。在你的情况下," Python:终端(集成)"调试选项。我需要的是调试控制台功能。我同时使用这两个函数,它们显示了我希望输出显示的输出。
答案 2 :(得分:4)
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"stopOnEntry": false,
"console": "none"
},
这些是我的launch.json设置,并且可以使用它。
答案 3 :(得分:2)
从不久以前开始,我还可以添加此选项...不确定以前是否可以:
{
...
"internalConsoleOptions": "openOnSessionStart",
...
}
希望这会有所帮助
答案 4 :(得分:1)
答案 5 :(得分:0)
接受的答案对我不起作用,因为它似乎不是我的VSCode Version 1.30.2 (1.30.2)
版本的选项:
Unknown console type 'none'.
对我来说,解决方案是改用internalConsole
选项。我想我的版本必须默认为integratedTerminal
选项。
这里是一个例子:
NOTE: this is an example from my nodejs project but the console portion is still relevant regardless of project type. I have included more to show some context as well as other features such as envFile usage.
...
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"envFile": "${workspaceRoot}/.env",
"program": "${workspaceFolder}/src/index.js",
"autoAttachChildProcesses": true,
"console": "internalConsole"
},
...