【发布时间】:2015-07-23 09:09:02
【问题描述】:
我尝试为 tslint 实现模式匹配器,但它出了问题。我确定正确指定了正则表达式,但 VSC 不断突出显示不正确的文件。这是我的 tasks.json 文件:
{
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"args": [
],
"tasks": [
{
"taskName": "build",
"args": [],
"isBuildCommand": true,
"problemMatcher": [
{
"owner": "gulp",
"fileLocation": ["absolute"],
"pattern": {
"regexp": "^\\[[^>]* > ([^(]*)\\((\\d*),(\\d*)\\): (error) (.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
},
{
"owner": "gulp",
"fileLocation": ["relative", "${workspaceRoot}/src/"],
"pattern": {
"regexp": "^\\([a-z\\-]*\\) ([^\\[]*)\\[([\\d]*), ([\\d]*)\\]: (.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 1,
"message": 4
}
}
]
}
]
}
【问题讨论】:
-
我对此也很感兴趣。我不知道 VSC 有能力做到这一点。有没有为 vsc 设置代码突出显示的人对此有所了解?
-
0.2.0 已修正,现在可以正常使用了。在 vs code 网页上查看有关如何添加新匹配器的描述(在任务下)。您还需要了解正则表达式才能做到这一点。
-
去过那里,做到了,但我的匹配器不匹配任何东西......也许你可以帮助我? stackoverflow.com/questions/34055354/…