<div dir="ltr">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.<div><br></div><div>What do others think?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 25, 2020 at 1:47 PM via clangd-dev <<a href="mailto:clangd-dev@lists.llvm.org">clangd-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div id="gmail-m_9181555940233991054geary-body" dir="auto"><div>Hi Folks,</div><div><br></div><div>how about providing a pre-defined problem matcher for clang's diagnostic output to the clangd VS Code extension?</div><div><br></div><div>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.</div><div><br></div><div>The solution is to append something like that:</div><div><br></div><div><span style="white-space:pre-wrap">             </span>"problemMatchers": [</div><div><span style="white-space:pre-wrap">                   </span>{</div><div><span style="white-space:pre-wrap">                                </span>"name": "clang",</div><div><span style="white-space:pre-wrap">                             </span>"owner": "cpp",</div><div><span style="white-space:pre-wrap">                              </span>"fileLocation": [</div><div><span style="white-space:pre-wrap">                                      </span>"relative",</div><div><span style="white-space:pre-wrap">                                    </span>"${workspaceRoot}"</div><div><span style="white-space:pre-wrap">                             </span>],</div><div><span style="white-space:pre-wrap">                               </span>"pattern": {</div><div><span style="white-space:pre-wrap">                                   </span>"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",</div><div><span style="white-space:pre-wrap">                                       </span>"file": 1,</div><div><span style="white-space:pre-wrap">                                     </span>"line": 2,</div><div><span style="white-space:pre-wrap">                                     </span>"column": 3,</div><div><span style="white-space:pre-wrap">                                   </span>"severity": 4,</div><div><span style="white-space:pre-wrap">                                 </span>"message": 5<u></u><div><span style="white-space:pre-wrap">                            </span>}</div><div><span style="white-space:pre-wrap">                        </span>}</div><div><span style="white-space:pre-wrap">                </span>]</div><div><br></div><div>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.</div><div><br></div><div>I've patched that into my copy of vscode-clangd's package.json file and it works like expected.</div><div><br></div><div>May be that could be of some good use for someone else out there.</div><div><br></div><div>Regards,</div><div><br></div><div>Andreas</div></div>_______________________________________________<br>
clangd-dev mailing list<br>
<a href="mailto:clangd-dev@lists.llvm.org" target="_blank">clangd-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev</a><br>
</div></blockquote></div>