If you’re using Doxygen to generate your project’s documentation, it would be nice to see errors in Visual Studio Code’s “Problems” panel so you can assess them and jump directly to them in the source code.
This can be achieved by creating a build task to run Doxygen, and a custom problem matcher to gather the errors.
Add a new task to VSCode’s tasks.json
file. If the file does not exist, create it in the “.vscode” directory.
{
"version": "2.0.0",
"tasks": [
{
"type": "process",
"label": "Build documentation",
"command": "doxygen",
"group": "build",
"problemMatcher": [
{
"owner": "cpp",
"fileLocation": "absolute",
"pattern": {
"regexp": "^([^:]+):(\\d+): (error|warning): (.*?)( \\(warning treated as error, aborting now\\))?$",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
}
],
"detail": "Build documentation"
}
]
}
You can run the task from the toolbar by selecting “Tasks: Run Task” and choosing “Build documentation”.