我在vscode中创建了一个任务,但是运行时会出错。
构建任务task.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [{
"label": "mypy",
"type": "shell",
"command": "mypy",
"args": [
"($file)"
],
"group": {
"kind": "build",
"isDefault": true
}
}]
}
我收到的错误是
> Executing task: mypy ($file) <
/bin/bash: -c: line 0: syntax error near unexpected token `$file'
/bin/bash: -c: line 0: `mypy ($file)'
The terminal process terminated with exit code: 1
Terminal will be reused by tasks, press any key to close it.
答案 0 :(得分:1)
尝试${file}
获取当前打开的文件详细信息。
参考:https://code.visualstudio.com/docs/editor/variables-reference