[PATCH] D103449: [clangd][Protocol] Drop optional from WorkspaceEdit::changes
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 2 11:16:37 PDT 2021
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.
changes is in fact optional, indicated by the `?` in `changes?: { [uri: DocumentUri]: TextEdit[]; };`.
But the spec requires *some* field to be set, and this is the only one we support, so it's not optional in practice for us.
================
Comment at: clang-tools-extra/clangd/Protocol.cpp:811
llvm::json::Value toJSON(const WorkspaceEdit &WE) {
- if (!WE.changes)
+ if (WE.changes.empty())
return llvm::json::Object{};
----------------
I'd suggest deleting this special case.
We no longer have two distinct states of our WorkspaceEdit struct to represent `{changes:{}}` and `{}`.
`{changes:{}}` is a well-defined empty edit, even if that never makes sense to actually send.
`{}` conforms to the typescript type definition of the spec, but doesn't actually define an edit per the spec text.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103449/new/
https://reviews.llvm.org/D103449
More information about the cfe-commits
mailing list