[PATCH] D51214: [clangd] Add options to enable/disable fixits and function argument snippets.
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 24 06:35:14 PDT 2018
kadircet created this revision.
kadircet added reviewers: hokein, ioeric, ilya-biryukov.
Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay.
Currently LSP clients cannot directly change IncludeFixIts or
EnableFunctionArgSnippets parameters. This patch is to provide them with a way
to enable/disable that functionality.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D51214
Files:
clangd/tool/ClangdMain.cpp
Index: clangd/tool/ClangdMain.cpp
===================================================================
--- clangd/tool/ClangdMain.cpp
+++ clangd/tool/ClangdMain.cpp
@@ -194,6 +194,19 @@
"'compile_commands.json' files")),
llvm::cl::init(FilesystemCompileArgs), llvm::cl::Hidden);
+static llvm::cl::opt<bool> IncludeFixIts(
+ "include-fixits",
+ llvm::cl::desc(
+ "Enables suggestion of completion items that needs additional changes. "
+ "Like changing an arrow(->) member access to dot(.) member access."),
+ llvm::cl::init(clangd::CodeCompleteOptions().IncludeFixIts));
+
+static llvm::cl::opt<bool> EnableFunctionArgSnippets(
+ "enable-function-arg-snippets",
+ llvm::cl::desc("Gives snippets for function arguments, when disabled only "
+ "gives parantheses for the call."),
+ llvm::cl::init(clangd::CodeCompleteOptions().EnableFunctionArgSnippets));
+
int main(int argc, char *argv[]) {
llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
llvm::cl::SetVersionPrinter([](llvm::raw_ostream &OS) {
@@ -309,6 +322,8 @@
CCOpts.IncludeIndicator.NoInsert.clear();
}
CCOpts.SpeculativeIndexRequest = Opts.StaticIndex;
+ CCOpts.IncludeFixIts = IncludeFixIts;
+ CCOpts.EnableFunctionArgSnippets = EnableFunctionArgSnippets;
// Initialize and run ClangdLSPServer.
ClangdLSPServer LSPServer(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51214.162370.patch
Type: text/x-patch
Size: 1399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180824/210e6ba9/attachment.bin>
More information about the cfe-commits
mailing list