This is an initial patch to add TextDocumentEdit (versioned edits) support in
clangd, the scope is minimal:
- add and extend the corresponding protocol structures
- propagate the documentChanges for diagnostic codeactions (our motivated case)
Paths
| Differential D148783
[clangd] Add support TextDocumentEdit. ClosedPublic Authored by hokein on Apr 20 2023, 12:13 AM.
Details
Summary This is an initial patch to add TextDocumentEdit (versioned edits) support in
Diff Detail
Event Timeline
Comment Actions can you also have a version of the clang-tools-extra/clangd/test/fixits-command.test with documentChanges support? it's unlikely to have clients in that configuration but i believe the deserialization issue i mentioned above would be discoverable by such a test.
Comment Actions
I'm happy to add a test for that, but I'm not sure the deserialization issue you mentioned in the comment, is the one to use mapOptional?
Comment Actions
yes it was for mapOptional, which turns out not to be an issue as there's a specialization for optional<T>. but still having that test to verify deserialization logic wouldn't hurt.
Comment Actions address review comments, added one more test for command code-actions
Comment Actions thanks!
This revision is now accepted and ready to land.Apr 25 2023, 3:10 AM This revision was landed with ongoing or failed builds.Apr 25 2023, 4:07 AM Closed by commit rG67e02b282b70: [clangd] Add support TextDocumentEdit. (authored by hokein). · Explain Why This revision was automatically updated to reflect the committed changes. Comment Actions Hi, these tests are failing on our (Linaro's) Windows on Arm buildbot. First appearance here https://lab.llvm.org/buildbot/#/builders/65/builds/9346 Still failing as of a few hours ago https://lab.llvm.org/buildbot/#/builders/65/builds/9360 (maybe you have fixed this already, I am checking in infrequently over the next few days). If you need any help debugging it let me know. It appears there is a drive letter on Windows: # CHECK-NEXT: "uri": "file:///clangd-test/foo.c", ^ <stdin>:224:30: note: scanning from here "textDocument": { ^ <stdin>:225:15: note: possible intended match here "uri": "file:///C:/clangd-test/foo.c", ^ Comment Actions
sorry for the breakage, looking now.
Revision Contents
Diff 516742 clang-tools-extra/clangd/ClangdLSPServer.h
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/Diagnostics.h
clang-tools-extra/clangd/Diagnostics.cpp
clang-tools-extra/clangd/Protocol.h
clang-tools-extra/clangd/Protocol.cpp
clang-tools-extra/clangd/test/fixits-codeaction-documentchanges.test
clang-tools-extra/clangd/test/fixits-command-documentchanges.test
clang-tools-extra/clangd/test/fixits-embed-in-diagnostic.test
|
instead of a pair maybe a: