From 2b6f4b7cdfb3ba17743f8fa8155dca32148e93d1 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Mon, 17 Apr 2017 20:54:20 -0700 Subject: [PATCH] Enable configuration of max workspace search results. --- src/command_line.cc | 5 ++--- src/language_server_api.h | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/command_line.cc b/src/command_line.cc index 5e26b89e..a46bf639 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -33,7 +33,6 @@ namespace { -const int kMaxWorkspaceSearchResults = 1000; const bool kUseMultipleProcesses = false; // TODO: initialization options not passed properly when set to true. @@ -1519,8 +1518,8 @@ void QueryDbMainLoop( std::string query = msg->params.query; for (int i = 0; i < db->detailed_names.size(); ++i) { - if (response.result.size() > kMaxWorkspaceSearchResults) { - std::cerr << "Query exceeded maximum number of responses (" << kMaxWorkspaceSearchResults << "), output may not contain all results" << std::endl; + if (response.result.size() >= config->maxWorkspaceSearchResults) { + std::cerr << "Query exceeded maximum number of responses (" << config->maxWorkspaceSearchResults << "), output may not contain all results" << std::endl; break; } diff --git a/src/language_server_api.h b/src/language_server_api.h index a4af77c7..2c785856 100644 --- a/src/language_server_api.h +++ b/src/language_server_api.h @@ -60,8 +60,9 @@ struct IndexerConfig { NonElidedVector whitelist; NonElidedVector blacklist; int indexerCount = 1; + int maxWorkspaceSearchResults = 1000; }; -MAKE_REFLECT_STRUCT(IndexerConfig, cacheDirectory, whitelist, blacklist, indexerCount); +MAKE_REFLECT_STRUCT(IndexerConfig, cacheDirectory, whitelist, blacklist, indexerCount, maxWorkspaceSearchResults);