Add an option to disable EmitProgress methods during indexing

This commit is contained in:
Josh Elsasser 2017-11-26 14:20:43 -08:00 committed by Jacob Dufault
parent d1692c8deb
commit 76785105ed
2 changed files with 17 additions and 11 deletions

View File

@ -796,16 +796,18 @@ struct IndexManager {
}
};
// Sends indexing progress to client.
void EmitProgress(QueueManager* queue) {
Out_Progress out;
out.params.indexRequestCount = queue->index_request.Size();
out.params.doIdMapCount = queue->do_id_map.Size();
out.params.loadPreviousIndexCount = queue->load_previous_index.Size();
out.params.onIdMappedCount = queue->on_id_mapped.Size();
out.params.onIndexedCount = queue->on_indexed.Size();
// Send indexing progress to client if reporting is enabled.
void EmitProgress(Config *config, QueueManager* queue) {
if (config->enableProgressReports) {
Out_Progress out;
out.params.indexRequestCount = queue->index_request.Size();
out.params.doIdMapCount = queue->do_id_map.Size();
out.params.loadPreviousIndexCount = queue->load_previous_index.Size();
out.params.onIdMappedCount = queue->on_id_mapped.Size();
out.params.onIndexedCount = queue->on_indexed.Size();
IpcManager::instance()->SendOutMessageToClient(IpcId::Cout, out);
IpcManager::instance()->SendOutMessageToClient(IpcId::Cout, out);
}
}
} // namespace
@ -1211,7 +1213,7 @@ WorkThread::Result IndexMain(Config* config,
WorkingFiles* working_files,
MultiQueueWaiter* waiter,
QueueManager* queue) {
EmitProgress(queue);
EmitProgress(config, queue);
// TODO: dispose of index after it is not used for a while.
ClangIndex index;
@ -1256,7 +1258,7 @@ bool QueryDb_ImportMain(Config* config,
ImportManager* import_manager,
QueueManager* queue,
WorkingFiles* working_files) {
EmitProgress(queue);
EmitProgress(config, queue);
bool did_work = false;

View File

@ -36,6 +36,9 @@ struct Config {
// If false, the index will not be loaded from a previous run.
bool enableCacheRead = true;
// If true, cquery will send progress reports while indexing
bool enableProgressReports = true;
// If true, document links are reported for #include directives.
bool showDocumentLinksOnIncludes = true;
@ -87,6 +90,7 @@ MAKE_REFLECT_STRUCT(Config,
enableIndexing,
enableCacheWrite,
enableCacheRead,
enableProgressReports,
includeCompletionMaximumPathLength,
includeCompletionWhitelistLiteralEnding,