Sending fixits to client with LSP diagnostics

Hi,

Has there been any discussion on sending fixits from the server to client as part of the ‘publishDiagnostics’ LSP response?
I would like to start working on an extension for this (disabled by default), and would like to avoid duplicate work if there are already people working on it :slight_smile:

Thanks,
Alex

Hi Alex,

We discussed it internally inside our team and I think everyone agrees that would be the right thing to do. We don’t work on it currently, though, so no overlap on our side.
Unfortunately, LSP does not support this, so this would be an extension.

BTW, consider implementing the current scheme for fix-its that uses textDocument/codeAction and matches on sent diagnostics. It’s not ideal, as it forces clangd to stash fix-its in memory. But it does work well in practice (we’ve tested only in VSCode, though).
If you don’t need to support applying diagnostics in batches, this approach might work well for your use-case too.

Thanks for the reply! I’ll work on the patch to add the support for fix-its.

Thanks for the reply! I’ll work on the patch to add the support for fix-its.

FWIW, I think our internal pseudo-LSP-over-protobuf client does the same thing.
So the C++ API in ClangdServer should all be there, making this extension straightforward. And if you lean towards making the XPC service a different protocol, this is certainly a sensible place to diverge.
IMO this is a place where LSP is a bit hamstrung by VSCode’s UI idiosyncrasies…

(Still out on parental leave for a couple of weeks, so I might be missing some relevant discussions)