简体   繁体   English

VSCode TypeScript问题Matcher不起作用

[英]VSCode TypeScript problemMatcher not working

I desire a problem matcher which reports two kinds of problems: 我希望有一个问题匹配器,它报告两种问题:

  1. typescript compilation problems 打字稿编译问题
  2. tslint problems tslint问题

This isn't working in one of my projects, but is working in others. 这在我的一个项目中不起作用,但是在其他项目中。 Here is the problem matcher line from the .vscode/tasks.json : 这是.vscode/tasks.json的问题匹配器行:

"problemMatcher": [
    "$tsc",
    {
        "owner": "tslint",
        "fileLocation": "relative",
        "severity": "error",
        "pattern": {
            "regexp": "^ERROR:\\s*(.*\\.ts)\\[(\\d+), (\\d+)\\]: (.*)$",
            "file": 1,
            "line": 2,
            "column": 3,
            "message": 4
        }
    }
]

I believe the problems weren't being picked up, because they were being prefixed by browserify or tsify . 我相信没有被拾起的问题,因为他们被前缀browserifytsify

The following configuration solved the problem, and should report problems for regular tsc compilation, browserify/tsify compilation, and tslint: 以下配置解决了该问题,并应报告常规tsc编译,browserify / tsify编译和tslint的问题:

"problemMatcher": [
    "$tsc",
    {
        "owner": "typescript",
        "fileLocation": ["relative", "${workspaceRoot}"],
        "pattern": {
            "regexp": "^TypeScript (warning|error): (.*)\\((\\d+),(\\d+)\\): (.*)$",
            "severity": 1,
            "file": 2,
            "line": 3,
            "column": 4,
            "message": 5
        }
    },
    {
        "owner": "tslint",
        "fileLocation": "relative",
        "severity": "error",
        "pattern": {
            "regexp": "^ERROR:\\s*(.*\\.ts)\\[(\\d+), (\\d+)\\]: (.*)$",
            "file": 1,
            "line": 2,
            "column": 3,
            "message": 4
        }
    }
]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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