[PATCH] D50415: [clangd] extend the publishDiagnostics response to send back fixits to the client directly as well (if requested)

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 7 18:43:09 PDT 2018


Couple of thoughts. (Technically I'm out on leave so will let Jan/Ilya
review implementation and happy with whatever you decide)

Enabling
- negotiating LSP extensions is probably better done in the "capabilities"
message exchange than as a command-line flag. Generally, we want this
extension on if the *client* is aware of it. Roughly, the client
capabilities are owned by the client, and the flags are owned by the *user*.
- for simplicity, we could always enable this, unless we really think the
message size is a problem, or are worried about conflicts with future LSP
versions

Naming
- elsewhere in clangd we settled on calling a "Fix" what clang calls a
"FixItHint". The latter is long/awkward/jargon, and often gets shortened to
"FixIt" which isn't obviously a noun. The former mostly has its plain
English meaning. I'd prefer "fix" in the protocol/flags, for the same
reasons.
- obviously feel free to give these any name you prefer in your UI!

On Wed, Aug 8, 2018, 00:53 Alex Lorenz via Phabricator <
reviews at reviews.llvm.org> wrote:

> arphaman created this revision.
> arphaman added reviewers: jkorous, sammccall, ilya-biryukov.
> Herald added subscribers: dexonsmith, MaskRay, ioeric.
>
> This change extends the 'textDocument/publishDiagnostics' notification
> sent from Clangd to the client. The extension can be enabled using the
> '-fixit-usage=embed-in-diagnostic' argument. When it's enabled, Clangd
> sends out the fixits associated with the appropriate diagnostic in the body
> of the 'publicDiagnostics' notification.
>
>
> Repository:
>   rCTE Clang Tools Extra
>
> https://reviews.llvm.org/D50415
>
> Files:
>   clangd/ClangdLSPServer.cpp
>   clangd/ClangdLSPServer.h
>   clangd/Diagnostics.h
>   clangd/fuzzer/ClangdFuzzer.cpp
>   clangd/tool/ClangdMain.cpp
>   test/clangd/fixits-embed-in-diagnostic.test
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180808/42a36d5d/attachment.html>


More information about the cfe-commits mailing list