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

via clangd-dev clangd-dev at lists.llvm.org
Tue Feb 25 09:04:36 PST 2020


You're right, Sam, although - from a certain point of view - clangd IS 
clang.

Yes, clangd doesn't run clang. But its users most probably do (either 
clang or gcc; the problemMatcher in question fits both). And, to my 
knowledge, their is no obvious extension to provide it.


On Tue, Feb 25, 2020 at 14:56, Sam McCall <sammccall at google.com> wrote:
> Having such a matcher somewhere shared makes sense but it's not 
> obvious it belongs in the clangd extension - neither clangd nor its 
> extension actually run clang.
> 
> What do others think?
> 
> On Tue, Feb 25, 2020 at 1:47 PM via clangd-dev 
> <clangd-dev at lists.llvm.org <mailto:clangd-dev at lists.llvm.org>> wrote:
>> 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
>> _______________________________________________
>>  clangd-dev mailing list
>> clangd-dev at lists.llvm.org <mailto:clangd-dev at lists.llvm.org>
>> <https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev>

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


More information about the clangd-dev mailing list