Visual Studio Code问题匹配器无法与自定义输出一起使用 [英] Visual Studio Code problem matcher not working with custom output
本文介绍了Visual Studio Code问题匹配器无法与自定义输出一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试让VS Code与自定义输出一起使用.我创建了一个打印出来的批处理文件:
I'm trying to get VS Code working with custom output. I've created a batch file which prints out:
warning:main.asm(5):Something is wrong
ERROR:main.asm(2):Something else is wrong
但是当我运行以下任务时:
But when I run the following task:
"tasks": [
{
"label": "build",
"type": "shell",
"command": "${workspaceFolder}\\build.bat",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher":{
"pattern":[
{
"regexp": "^.*:(.*)\\(\\d+\\):(.+)$",
"file": 1,
"line": 2,
"message": 3,
"location": 0
}]
}
}
]
我得到了期望的输出,但是在问题"窗口中没有出现任何错误.有什么想法吗?
I get the output that I'm expecting but I don't get any errors in the problems window. Any ideas?
推荐答案
您的正则表达式不完全正确-由于\\(\\d+\\)
周围的括号已被转义,因此它实际上不是捕获组.再加上一对或原谅,它对我有用:
Your regex isn't quite correct - since the parens around \\(\\d+\\)
are escaped, it's not actually a capturing group. With an additional pair or parens it works for me:
"regexp": "^.*:(.*)\\((\\d+)\\):(.+)$"
这篇关于Visual Studio Code问题匹配器无法与自定义输出一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文