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

Sam McCall via clangd-dev clangd-dev at lists.llvm.org
Tue Feb 25 05:56:44 PST 2020


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>
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
> 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/ee36dca2/attachment.html>


More information about the clangd-dev mailing list