From 17fb21f875f4aaf6ad2cf9499cb75d76588167f2 Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Thu, 14 Jan 2021 17:19:39 +0100 Subject: [PATCH] [clangd] Remove another option that was effectively always true. NFC --- clang-tools-extra/clangd/ClangdServer.cpp | 14 +++++--------- clang-tools-extra/clangd/CodeComplete.h | 10 ---------- clang-tools-extra/clangd/tool/ClangdMain.cpp | 1 - clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp | 1 - 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp index d5e21cf..4f3a47d 100644 --- a/clang-tools-extra/clangd/ClangdServer.cpp +++ b/clang-tools-extra/clangd/ClangdServer.cpp @@ -243,15 +243,11 @@ void ClangdServer::codeComplete(PathRef File, Position Pos, // No speculation in Fallback mode, as it's supposed to be much faster // without compiling. vlog("Build for file {0} is not ready. Enter fallback mode.", File); - } else { - if (CodeCompleteOpts.Index && CodeCompleteOpts.SpeculativeIndexRequest) { - SpecFuzzyFind.emplace(); - { - std::lock_guard Lock( - CachedCompletionFuzzyFindRequestMutex); - SpecFuzzyFind->CachedReq = - CachedCompletionFuzzyFindRequestByFile[File]; - } + } else if (CodeCompleteOpts.Index) { + SpecFuzzyFind.emplace(); + { + std::lock_guard Lock(CachedCompletionFuzzyFindRequestMutex); + SpecFuzzyFind->CachedReq = CachedCompletionFuzzyFindRequestByFile[File]; } } ParseInputs ParseInput{IP->Command, &TFS, IP->Contents.str()}; diff --git a/clang-tools-extra/clangd/CodeComplete.h b/clang-tools-extra/clangd/CodeComplete.h index f7ac3c7..ddcbd48 100644 --- a/clang-tools-extra/clangd/CodeComplete.h +++ b/clang-tools-extra/clangd/CodeComplete.h @@ -82,16 +82,6 @@ struct CodeCompleteOptions { /// Expose origins of completion items in the label (for debugging). bool ShowOrigins = false; - /// If set to true, this will send an asynchronous speculative index request, - /// based on the index request for the last code completion on the same file - /// and the filter text typed before the cursor, before sema code completion - /// is invoked. This can reduce the code completion latency (by roughly - /// latency of sema code completion) if the speculative request is the same as - /// the one generated for the ongoing code completion from sema. As a sequence - /// of code completions often have the same scopes and proximity paths etc, - /// this should be effective for a number of code completions. - bool SpeculativeIndexRequest = false; - // Populated internally by clangd, do not set. /// If `Index` is set, it is used to augment the code completion /// results. diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp index 9c75caf..d385910 100644 --- a/clang-tools-extra/clangd/tool/ClangdMain.cpp +++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp @@ -828,7 +828,6 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var Opts.CodeComplete.IncludeIndicator.Insert.clear(); Opts.CodeComplete.IncludeIndicator.NoInsert.clear(); } - Opts.CodeComplete.SpeculativeIndexRequest = Opts.StaticIndex; Opts.CodeComplete.EnableFunctionArgSnippets = EnableFunctionArgSnippets; Opts.CodeComplete.AllScopes = AllScopesCompletion; Opts.CodeComplete.RunParser = CodeCompletionParse; diff --git a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp index 43a557d..9842bcb 100644 --- a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp +++ b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp @@ -2339,7 +2339,6 @@ TEST(CompletionTest, EnableSpeculativeIndexRequest) { IndexRequestCollector Requests; Opts.Index = &Requests; - Opts.SpeculativeIndexRequest = true; auto CompleteAtPoint = [&](StringRef P) { cantFail(runCodeComplete(Server, File, Test.point(P), Opts)); -- 2.7.4