vscode-zig icon indicating copy to clipboard operation
vscode-zig copied to clipboard

Problem matcher gets incorrect paths

Open leecannon opened this issue 4 years ago • 0 comments

It seems like the problem matcher used when running the Zig: Build Workspace command is returning incorrect paths.

The paths are incorrectly absolute paths, for example an error with the path ./src/buffer.zig is shown in the problem tab with the path /src/buffer.zig; then trying to click on the problem results in vscode failing to open the file /src/buffer.zig.

Weirdly copying the problem matcher from this repository into my own task.json works perfectly, so the issue does not seem to be a bad regex pattern.

Working task.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "zig build",
            "type": "process",
            "command": "zig",
            "args": [
                "build"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "reveal": "never",
                "showReuseMessage": false,
                "clear": true,
                "revealProblems": "onProblem"
            },
            "problemMatcher": {
                "owner": "zig",
                "fileLocation": [
                    "relative",
                    "${workspaceFolder}"
                ],
                "pattern": {
                    "regexp": "([^\\s]*):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(error):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4,
                    "message": 5
                },
            }
        }
    ]
}

leecannon avatar Aug 26 '21 17:08 leecannon