[clangd-dev] LSP's diagnostic's 'code' and Clang's diagnostic category
Ilya Biryukov via clangd-dev
clangd-dev at lists.llvm.org
Wed Aug 8 04:35:23 PDT 2018
Hi Alex, Sam,
My guess would be that the original intention of the 'code' was to expose
the errors codes from various Microsoft's compiler, e.g.
- One of C++ error codes from MSVC:
- One of C# error codes:
If the guess is correct, sending a diagnostic name (e.g.
'err_expr_not_ice') seems to be aligned with the original intention, but
sending the generalized category is not.
With that in mind, I would be on the side of adding a 'category' field as
an extension, rather than trying to reuse the 'code' field.
On Wed, Aug 8, 2018 at 3:55 AM Sam McCall via clangd-dev <
clangd-dev at lists.llvm.org> wrote:
> 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
>>> 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
> 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:
>>>> 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?
>>>> clangd-dev mailing list
>>>> clangd-dev at lists.llvm.org
> clangd-dev mailing list
> clangd-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the clangd-dev