VS Code在集成终端而不是调试控制台中开始调试 [英] VS Code starts debugging in integrated terminal instead of debug console

查看:528
本文介绍了VS Code在集成终端而不是调试控制台中开始调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VS Code已经有一段时间了,直到今天我才开始遇到这个奇怪的问题。以前,如果我开始调试程序(F5),它将开始调试并在调试控制台中显示输出:

I've been using VS Code for quite some time and just today I started having this strange issue. Previously if I started debugging an program (F5) it would start debugging and show output in the "Debug Console":

但是现在它在终端中启动调试器

,并输出到调试控制台。

But now It starts debugger in the "Terminal" and also outputs to "Debug Console".

这是我的 launch.json

{
    "version": "0.2.0",
    "configurations": [{
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}"
        }
    ]
}



我想在调试中仅输出控制台(以前默认为行为)。请帮助我将其设置为原来的状态。


I want output only in the "Debug Console" (previously default behavior). Please help me with setting it back to the way it was.

推荐答案

编辑3



版本一样python扩展的2019.4.0 现在可以将控制台选项设置为 internalConsole (< a href = https://github.com/Microsoft/vscode-python/issues/4321 rel = noreferrer>#4321 )。

Edit 3

As with the release 2019.4.0 of the python extension it is now possible to set the console option to internalConsole (#4321).

.vscode / launch.json 中:

"console": "internalConsole"



编辑2



omartin2010的答案中建议,您还可以设置该选项

Edit 2

As suggested in omartin2010's answer you can additionally set the option

"internalConsoleOptions": "openOnSessionStart"

自动打开调试控制台开始调试时。

to automatically open the debug console when starting debugging.

控制台 选项显式设置为本来是要走的路(请参阅答案),但是现在无不再有效(请参见上面的编辑3)

Setting the "console" option explicitly to "none" was originally the way to go (see answers), but now "none" is no longer valid (see Edit 3 above)

"console": "none"



原始答案



为确保将输出写入调试控制台,您可以设置 debugOptions
launch.json 的配置中添加以下条目即可解决该问题:

Original answer

To ensure that the output is written to the debug console you can set the debugOptions. Adding the following entry to your configuration in yourlaunch.json should fix it:

"debugOptions": [
    "RedirectOutput"
]

这篇关于VS Code在集成终端而不是调试控制台中开始调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆