简体   繁体   中英

Can't get simple task to run in vscode

I am ultimately trying to set up vscode to build typescript, but I first just wanted to get a simple task to run, and I can't seem to get that to work. I now want to just run the "Hello world" task from https://code.visualstudio.com/docs/editor/tasks , which is to simply echo a string to the output window.

My tasks.json is in the .vscode folder, and its content is:

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

When I try to run the task from the command palette and choosing "Tasks: Run Task," I see "no tasks found" when I expect to see this echo task. I don't know why I don't see this task in a task list.

What am I doing wrong?

找不到任务

FWIW, my vscode version is 1.11.1.

This works on current 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"
            }
        }
    ]
}

What was wrong?

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

Also isShellCommand now became type , etc...

Also note the escaped space in the argument. (triggers explict complaint about it otherwise. Yes, despite the quotes around it.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM