task.json存在,但“未定义任务”

时间:2019-05-20 01:37:50

标签: json visual-studio-code vscode-settings

我在VSCode中打开了一个task.json。当我尝试“运行任务”时,我得到“没有要运行的任务。配置任务”。

尝试配置任务,我得到“ Open task.json”。但是task.json已经在VSCode中打开。关闭task.json并重新打开它会得到相同的结果。

帮助表示赞赏。如下所示的task.json。

{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
   "label": "GnuCOBOL - Compile (single file)",
   "type": "shell",
   "options": {
    "env": {
        "PATH":"\\gnucobol3\\bin",
        "COB_CONFIG_DIR": "c:\\gnucobol3\\config",
        "COB_COPY_DIR": "c:\\gnucobol3\\copy",
        "COB_INCLUDE_PATH": "c:\\gnucobol3\\include",
        "COB_LIB_PATH": "c:\\gnucobol3\\lib",
       },
    "command": "cobc",
    "args": [
      "-x",
      "-std=mf",
      "-t${fileBasenameNoExtension}.LST",
      "${file}"
      ]
    },
} 

3 个答案:

答案 0 :(得分:1)

您的tasks.json文件似乎已更改。格式应为:

{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",

  // "global" options can go here

  "options": {
    "env": {
        "APP_NAME": "Nice"
    }
  },

  // you are missing the tasks array

  "tasks": [

    {                             // task 1
            "label": "Task A",
            "type": "shell",
            "command": "echo A2",
            "problemMatcher": [],
            "presentation": {
                "group": "groupA"
            }
            // or task-specific options can go here
        },
        {                         //  task 2
            "label": "Task B",
            "type": "shell",
            "command": "echo B",
            "problemMatcher": [],
            "presentation": {
                "group": "groupA"
            }
        }
   ]
}

使用您的代码:

{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
  "options": {
    "env": {
      "PATH":"\\gnucobol3\\bin",
      "COB_CONFIG_DIR": "c:\\gnucobol3\\config",
      "COB_COPY_DIR": "c:\\gnucobol3\\copy",
      "COB_INCLUDE_PATH": "c:\\gnucobol3\\include",
      "COB_LIB_PATH": "c:\\gnucobol3\\lib",
     }
    },

    "tasks": [
       {
          "label": "GnuCOBOL - Compile (single file)",
          "type": "shell",
          "command": "cobc",
          "args": [
            "-x",
            "-std=mf",
            "-t${fileBasenameNoExtension}.LST",
            "${file}"
          ]
        }
      ]
    }
  }
}

答案 1 :(得分:0)

不确定如何回应-我的回应太大了,无法发表评论。

Mark:我已经修改了task.json,但是仍然遇到相同的错误:

UPDATE table SET Loan_time=SUBSTR(SUBSTRING_INDEX(Loan_time, ' Year', 1), 1, 2)*12

答案 2 :(得分:0)

标记:您的mod现在可以运行,但有错误:

> Executing task: cobc -x -std=mf -ttasks.LST c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json <

c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:2: error: invalid indicator 'e' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:3: error: invalid indicator 'o' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:4: error: invalid indicator 's' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:5: error: invalid indicator 'i' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:6: error: invalid indicator 'n' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:7: error: invalid indicator '"' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:8: error: invalid indicator '"' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:9: error: invalid indicator '"' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:10: error: invalid indicator '"' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:11: error: invalid indicator '"' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:14: error: invalid indicator 'k' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:16: error: invalid indicator '"' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:17: error: invalid indicator '"' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:18: error: invalid indicator '"' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:19: error: invalid indicator '"' at column 7
c:\WORKAREA\cobol\VisualStudioCode\.vscode\tasks.json:24: error: invalid indicator ']' at column 7