How to jump to build error in Visual Studio Code?

Etay Meiri picture Etay Meiri · Jan 25, 2017 · Viewed 9.1k times · Source

I'm using Visual Studio Code (Version 1.8.1) on Linux. When there is a build error and I click on the line that contains the error it doesn't jump to the corresponding line in the code. Is there a way to make Visual Studio Code behave the same as standard Visual Studio?

Answer

Gama11 picture Gama11 · Jan 25, 2017

Have you defined a problem matcher in your tasks.json? There are several built-in ones that can simply be referenced, for instance "problemMatcher": ["$tsc"] will work for TypeScript.

The docs also contain an example for a custom problem matcher for C++:

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

If there's no built-in matcher for the language you're using, you shoulds still be able to find one with a bit of searching if it's moderately popular.