[PATCH] D46670: [clangd] Move helpers that convert Replacements to TextEdits to SourceCode.h

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 11 02:53:21 PDT 2018


ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM, just a few non-blocking NITs with questions.



================
Comment at: clangd/SourceCode.cpp:180
+  // Turn the replacements into the format specified by the Language Server
+  // Protocol. Fuse them into one big JSON array.
+  std::vector<TextEdit> Edits;
----------------
NIT: the comment about json array does not make any sense, given that we merely return a vector.
(that was true before the change too)


================
Comment at: clangd/SourceCode.h:62
+std::vector<TextEdit>
+replacementsToEdits(StringRef Code,
+                    const std::vector<tooling::Replacement> &Replacements);
----------------
Do we really need to expose separate functions for `vector<tooling::Replacement>` and `tooling::Replacements`, given that both are trivial: loop over the array, convert each item?
Having them in `.cpp` file didn't hurt, but they seems redundant in the public header.
WDYT?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D46670





More information about the cfe-commits mailing list