[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:54:44 PDT 2018


On Wed, Aug 8, 2018, 03:46 Alex L <arphaman at gmail.com> wrote:

>
>
> 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/"?
>

Not quite: I think error diagnostics also have names as well as categories.
E.g. "Semantic Issue/err_expr_not_ice" (first error from
DiagnosticSemaKinds.td).

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.
>
Makes sense, one of the other options then.

(An LSP extension attribute seems marginally cleaner than parsing it out of
the code, but I'm happy with either)


>
>>
>> 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/20180808/9c5a1fcb/attachment-0001.html>


More information about the clangd-dev mailing list