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(
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(
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits