在集成终端 Visual Studio Code 上运行代码 [英] Run Code on integrated terminal Visual Studio Code

查看:42
本文介绍了在集成终端 Visual Studio Code 上运行代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 task.json 中有以下一段代码:

I have the following piece of code in my task.json:

    {
        "taskName": "Run",
        "suppressTaskName": true,
        "args": [
            "${workspaceRoot}/bin/Albedo"
        ]
    }

当我运行运行"时,程序按预期启动,但是当我在代码中有 getchar() 时,当我的程序卡在输出中时什么也没有发生.没有地方可以按 Enter 继续.

When I run "Run" the program starts as it is supposed to, but when I have getchar() in the code nothing happens when I the program it get stuck in the output. There is no place where I can press Enter to continue.

所以我在考虑如何打开集成终端并从那里运行它?是否可以从 task.json 调用这样的命令?

So I am thinking about how do I open the integrated terminal and run it from there? Would it be possible to call such a command from task.json?

推荐答案

此功能实际上是在即将发布的 1 月版本中添加的,请参阅 本部分 发行说明草稿.本质上,您只需要将其添加到您的 tasks.json 中:

This feature was actually added in the upcoming January release, see this section of the release notes draft. Essentially, you just have to add this to your tasks.json:

"_runner": "terminal"

如果您不想等到发布(应该很快)再检查一下,您可以使用 内部人员构建.

If you don't want to wait until release (which should be soon) to check this out, you can use an Insider's build.

这篇关于在集成终端 Visual Studio Code 上运行代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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