[PATCH] D38629: [clangd] Added a callback-based codeComplete in clangd.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 13 02:29:09 PDT 2017

sammccall added inline comments.

Comment at: clangd/ClangdServer.cpp:51
+template <class Ret, class... Args>
+std::future<Ret> makeFutureAPIFromCallback(
I'm not sure we need a template here rather than just writing the code directly.

Comment at: clangd/ClangdServer.cpp:257
+  // A task that will be run asynchronously.
+  auto Task =
+      // 'mutable' to reassign Preamble variable.
Isn't this exactly where you'd want to use ForwardBinder?
(Yeah, it looks like the work scheduler itself has this functionality too)

Comment at: clangd/ClangdServer.h:261
+  void codeComplete(
+      UniqueFunction<void(Tagged<std::vector<CompletionItem>>)> Callback,
+      PathRef File, Position Pos,
Hmm, generally having a callback as the last parameter is nicer, but this doesn't play nicely with optional params...


More information about the cfe-commits mailing list