[PATCH] D43229: [clangd] Enable snippet completion based on client capabilities.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 15 02:15:38 PST 2018


ioeric accepted this revision.
ioeric added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: clangd/ClangdLSPServer.cpp:90
 void ClangdLSPServer::onInitialize(InitializeParams &Params) {
+  if (Params.rootUri && !Params.rootUri->file.empty())
+    Server.setRootPath(Params.rootUri->file);
----------------
This was moved from the end to the top. Is this related to the snippet change here?


================
Comment at: clangd/Protocol.h:184
+  /// Client supports snippets as insert text.
+  llvm::Optional<bool> snippetSupport = false;
+  /// Client supports commit characters on a completion item.
----------------
Use default `Optional`? I think we would treat empty optional the same as `false` anyway?


================
Comment at: clangd/tool/ClangdMain.cpp:60
 
-static llvm::cl::opt<bool> EnableSnippets(
-    "enable-snippets",
----------------
Would we still have a way to disable snippets (e.g. for debugging) even if clients support them? Maybe make this a hidden option instead?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D43229





More information about the cfe-commits mailing list