无法在vscode

时间:2017-04-11 16:46:52

标签: visual-studio-code vscode-tasks

我最终试图设置vscode来构建typescript,但我首先想要一个简单的任务来运行,而我似乎无法让它工作。我现在想要运行" Hello world"来自https://code.visualstudio.com/docs/editor/tasks的任务,即将字符串简单地回显到输出窗口。

我的tasks.json位于.vscode文件夹中,其内容为:

{
    "version": "0.1.0",
    "command": "echo",
    "isShellCommand": true,
    "args": ["Hello World"],
    "showOutput": "always"
}

当我尝试从命令面板中运行任务并选择"任务:运行任务,"我看到"没有找到任务"当我希望看到这个回声任务。我不知道为什么我在任务列表中看不到这个任务。

我做错了什么?

No tasks found

FWIW,我的vscode版本是1.11.1。

1 个答案:

答案 0 :(得分:0)

这适用于当前的vscode:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "taskName": "MyHelloTask",
            "type": "shell",
            "command": "echo",
            "args": ["Hello\ World"],
            "presentation": {
                "echo": true,
                "reveal": "always",
                "panel": "shared"
            }
        }
    ]
}

出了什么问题?

The property showOutput is deprecated. Use the reveal
property inside the presentation property instead. 
See also the 1.14 release notes.

此外isShellCommand现已成为type等等......

还要注意参数中的转义空格。 (触发了对它的明显抱怨。是的,尽管它周围有引号。)