This patch adds a 'category' extension field to the LSP diagnostic that's sent by Clangd. This extension is always on by default.
Details
- Reviewers
jkorous ilya-biryukov sammccall - Commits
- rG37146431d23a: [clangd] add an extension field to LSP to transfer the diagnostic's category
rL339738: [clangd] add an extension field to LSP to transfer the diagnostic's category
rCTE339738: [clangd] add an extension field to LSP to transfer the diagnostic's category
Diff Detail
- Repository
- rCTE Clang Tools Extra
Event Timeline
clangd/Diagnostics.h | ||
---|---|---|
40 | Maybe store the string name of the category directly here? This struct was never optimized for efficiency, but aims to be independent of clang, so that the clients might interpret it without calling any clang-specific code (we do reuse the Level enum, though, but that's merely for code reuse) | |
clangd/Protocol.h | ||
549 | Maybe add a brief example of category names here, i.e. "semantic issue", etc.? |
LGTM. Let's watch out for possible breakages in any of the clients, though. I've checked VSCode and it seems to be fine with the added fields.
LGTM. Let's watch out for possible breakages in any of the clients, though. I've checked VSCode and it seems to be fine with the added fields.
This isn't in the spec and broke the LSP client eglot (https://github.com/joaotavora/eglot/pull/81). Why don't you put this in the "source" field, or concat it to the "message" field. Who can even use this information if it's not in the spec? Are clients supposed to code against every LSP server's whim?
Thanks for the feedback. I'll make a patch that turns this off by default so that clients can opt-in into it.
Thank you very much, and sorry if I came across a bit hostile. What is this category field good for?
Maybe store the string name of the category directly here? This struct was never optimized for efficiency, but aims to be independent of clang, so that the clients might interpret it without calling any clang-specific code (we do reuse the Level enum, though, but that's merely for code reuse)