[clang-tools-extra] r342533 - [clangd] Add option to enable/disable function argument snippets.
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 19 03:16:44 PDT 2018
Author: kadircet
Date: Wed Sep 19 03:16:44 2018
New Revision: 342533
URL: http://llvm.org/viewvc/llvm-project?rev=342533&view=rev
Log:
[clangd] Add option to enable/disable function argument snippets.
Summary:
Currently LSP clients cannot directly change EnableFunctionArgSnippets parameter.
This patch is to provide them with a way to enable/disable that functionality.
Reviewers: hokein, ioeric, ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: sammccall, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D51214
Modified:
clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
Modified: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp?rev=342533&r1=342532&r2=342533&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp (original)
+++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp Wed Sep 19 03:16:44 2018
@@ -169,6 +169,13 @@ static llvm::cl::opt<CompileArgsFrom> Co
"'compile_commands.json' files")),
llvm::cl::init(FilesystemCompileArgs), llvm::cl::Hidden);
+static llvm::cl::opt<bool> EnableFunctionArgSnippets(
+ "function-arg-placeholders",
+ llvm::cl::desc("When disabled, completions contain only parentheses for "
+ "function calls. When enabled, completions also contain "
+ "placeholders for method parameters."),
+ llvm::cl::init(clangd::CodeCompleteOptions().EnableFunctionArgSnippets));
+
int main(int argc, char *argv[]) {
llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
llvm::cl::SetVersionPrinter([](llvm::raw_ostream &OS) {
@@ -296,6 +303,7 @@ int main(int argc, char *argv[]) {
CCOpts.IncludeIndicator.NoInsert.clear();
}
CCOpts.SpeculativeIndexRequest = Opts.StaticIndex;
+ CCOpts.EnableFunctionArgSnippets = EnableFunctionArgSnippets;
// Initialize and run ClangdLSPServer.
ClangdLSPServer LSPServer(
More information about the cfe-commits
mailing list