summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/tool/ClangdMain.cpp
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2018-09-27 18:46:00 +0000
committerEric Liu <ioeric@google.com>2018-09-27 18:46:00 +0000
commit670c147d83bcaada7a906206d41769389fecf291 (patch)
treedf7521d6a39116d7458d772dfbeaaa09644aac1d /clang-tools-extra/clangd/tool/ClangdMain.cpp
parentee7fe93fa8a915dec65ea67fa819aaa79275636d (diff)
downloadbcm5719-llvm-670c147d83bcaada7a906206d41769389fecf291.tar.gz
bcm5719-llvm-670c147d83bcaada7a906206d41769389fecf291.zip
[clangd] Initial supoprt for cross-namespace global code completion.
Summary: When no scope qualifier is specified, allow completing index symbols from any scope and insert proper automatically. This is still experimental and hidden behind a flag. Things missing: - Scope proximity based scoring. - FuzzyFind supports weighted scopes. Reviewers: sammccall Reviewed By: sammccall Subscribers: kbobyrev, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52364 llvm-svn: 343248
Diffstat (limited to 'clang-tools-extra/clangd/tool/ClangdMain.cpp')
-rw-r--r--clang-tools-extra/clangd/tool/ClangdMain.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index 4c6a4c35246..aebff518932 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -136,6 +136,15 @@ static llvm::cl::opt<bool> EnableIndex(
"enabled separatedly."),
llvm::cl::init(true), llvm::cl::Hidden);
+static llvm::cl::opt<bool> AllScopesCompletion(
+ "all-scopes-completion",
+ llvm::cl::desc(
+ "If set to true, code completion will include index symbols that are "
+ "not defined in the scopes (e.g. "
+ "namespaces) visible from the code completion point. Such completions "
+ "can insert scope qualifiers."),
+ llvm::cl::init(false), llvm::cl::Hidden);
+
static llvm::cl::opt<bool>
ShowOrigins("debug-origin",
llvm::cl::desc("Show origins of completion items"),
@@ -304,6 +313,7 @@ int main(int argc, char *argv[]) {
}
CCOpts.SpeculativeIndexRequest = Opts.StaticIndex;
CCOpts.EnableFunctionArgSnippets = EnableFunctionArgSnippets;
+ CCOpts.AllScopes = AllScopesCompletion;
// Initialize and run ClangdLSPServer.
ClangdLSPServer LSPServer(
OpenPOWER on IntegriCloud