[clangd-dev] LSP's diagnostic's 'code' and Clang's diagnostic category

Sam McCall via clangd-dev clangd-dev at lists.llvm.org
Tue Aug 7 18:29:25 PDT 2018

Good question! I'm not aware of any discussion around this.

Using the diagnostic category seems a little course-grained, I think the
most natural fit would be the diagnostic name itself like

If you want the category too, any of these seem ok to me:
- code = category/name, e.g. "Parse/warn_asm_qualifier_ignored"
- add "category" attribute to diagnostic as LSP extension (I'd have no
problem with keeping this always on)
- keep a lookup table in the client (if consuming the tabledef files and
maintaining version lock works for you)

What do you think?

On Wed, Aug 8, 2018, 01:50 Alex L via clangd-dev <clangd-dev at lists.llvm.org>

> Hi,
> I noticed that Clangd doesn't currently use LSP's 'code' field in the
> Diagnostic structure when publishing the diagnostics. I would like to use
> it to send the name of the diagnostic's category to the client (e.g.
> "Semantic Issue" / "Parsing Issue"). Would it make sense to use the 'code'
> field for this, and would it make sense to turn it on by default? Are there
> any other plans to use it for something else instead?
> Cheers,
> Alex
> _______________________________________________
> clangd-dev mailing list
> clangd-dev at lists.llvm.org
> http://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/20180808/09862d2f/attachment.html>

More information about the clangd-dev mailing list