[clangd-dev] vscode-clangd: Providing a Problem Matcher for Clang

via clangd-dev clangd-dev at lists.llvm.org
Tue Feb 25 01:12:39 PST 2020


Hi Folks,

how about providing a pre-defined problem matcher for clang's 
diagnostic output to the clangd VS Code extension?

I DO NOT use the Microsoft C/C++ extension, but vscode-clangd and 
CodeLLDB instead. The only thing I'm missing is the predefined gcc 
problemMatcher since I'm using one for several build tasks. Yes, I can 
define it in-place, but for each task a new one. And, like every 
developer, it drives me crazy to have redundant code somewhere.

The solution is to append something like that:

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

to the contributes block of the vscode-clangd package.json file. Since 
it's named "clang" it shouldn't interfere with some oyher installed 
extension like the Microsoft's one.

I've patched that into my copy of vscode-clangd's package.json file and 
it works like expected.

May be that could be of some good use for someone else out there.

Regards,

Andreas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/clangd-dev/attachments/20200225/c335b195/attachment.html>


More information about the clangd-dev mailing list