Visual Studio Code problem matcher not working with custom output

梦想的初衷 提交于 2019-12-08 04:05:12

问题


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?


回答1:


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+)\\):(.+)$"



来源:https://stackoverflow.com/questions/47775169/visual-studio-code-problem-matcher-not-working-with-custom-output

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!