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

Alex L via clangd-dev clangd-dev at lists.llvm.org
Tue Aug 7 18:46:33 PDT 2018

On 7 August 2018 at 18:29, Sam McCall <sammccall at google.com> wrote:

> 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
> "warn_asm_qualifier_ignored".
> If you want the category too, any of these seem ok to me:
> - code = category/name, e.g. "Parse/warn_asm_qualifier_ignored"

Just to make sure I understand this correctly: for warnings the code would
be something like "Parse Issue/warn_asm_qualifier_ignored", and for errors
we would just send "Semantic Issue/"?
That should work for us.

> - 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)

Not really, we want to send the category name from the server.

> What do you think?
> On Wed, Aug 8, 2018, 01:50 Alex L via clangd-dev <
> clangd-dev at lists.llvm.org> wrote:
>> 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/20180807/0cdd8e92/attachment.html>

More information about the clangd-dev mailing list