diff --git a/src/lib/component/controller/CodeController.cpp b/src/lib/component/controller/CodeController.cpp index f7d0ec89..20ada589 100644 --- a/src/lib/component/controller/CodeController.cpp +++ b/src/lib/component/controller/CodeController.cpp @@ -37,6 +37,7 @@ void CodeController::handleMessage(MessageActivateAll* message) std::vector snippets = getSnippetsForCollection(m_collection); StorageStats stats = m_storageAccess->getStorageStats(); + ErrorCountInfo errorCount = m_storageAccess->getErrorCount(); CodeSnippetParams statsSnippet; statsSnippet.startLineNumber = 1; @@ -69,10 +70,10 @@ void CodeController::handleMessage(MessageActivateAll* message) ss << "\t" + std::to_string(stats.nodeCount) + " symbols\n"; ss << "\t" + std::to_string(stats.edgeCount) + " relations\n"; ss << "\n"; - ss << "\t" + std::to_string(stats.errorCount.total) + " errors (" + std::to_string(stats.errorCount.fatal) + " fatal)\n"; + ss << "\t" + std::to_string(errorCount.total) + " errors (" + std::to_string(errorCount.fatal) + " fatal)\n"; ss << "\n"; - if (stats.errorCount.total > 0) + if (errorCount.total > 0) { ss << "\tWarning: Indexing may be incomplete as long as it yields fatal errors.\n"; ss << "\tTry resolving them and refresh the project.\n"; diff --git a/src/lib/component/controller/IDECommunicationController.cpp b/src/lib/component/controller/IDECommunicationController.cpp index 77d2c01f..de0e3aa1 100644 --- a/src/lib/component/controller/IDECommunicationController.cpp +++ b/src/lib/component/controller/IDECommunicationController.cpp @@ -1,11 +1,11 @@ -#include -#include #include "IDECommunicationController.h" #include "data/access/StorageAccess.h" #include "data/location/TokenLocationFile.h" #include "data/location/TokenLocation.h" +#include "settings/ApplicationSettings.h" +#include "utility/file/FileSystem.h" #include "utility/messaging/type/MessageActivateTokenLocations.h" #include "utility/messaging/type/MessageActivateWindow.h" #include "utility/messaging/type/MessageDispatchWhenLicenseValid.h" diff --git a/src/lib/data/PersistentStorage.cpp b/src/lib/data/PersistentStorage.cpp index e67b167c..6bfe144f 100644 --- a/src/lib/data/PersistentStorage.cpp +++ b/src/lib/data/PersistentStorage.cpp @@ -359,9 +359,12 @@ void PersistentStorage::logStats() const ss << "\t" << stats.fileCount << " Files\n"; ss << "\t" << stats.fileLOCCount << " Lines of Code\n"; + + ErrorCountInfo errorCount = getErrorCount(); + ss << "\nErrors:\n"; - ss << "\t" << stats.errorCount.total << " Errors\n"; - ss << "\t" << stats.errorCount.fatal << " Fatal Errors\n"; + ss << "\t" << errorCount.total << " Errors\n"; + ss << "\t" << errorCount.fatal << " Fatal Errors\n"; LOG_INFO(ss.str()); } @@ -1108,8 +1111,6 @@ StorageStats PersistentStorage::getStorageStats() const stats.fileCount = m_sqliteStorage.getFileCount(); stats.fileLOCCount = m_sqliteStorage.getFileLOCCount(); - stats.errorCount = getErrorCount(); - return stats; } diff --git a/src/lib/data/StorageCache.cpp b/src/lib/data/StorageCache.cpp index 578115cf..aefaea3c 100644 --- a/src/lib/data/StorageCache.cpp +++ b/src/lib/data/StorageCache.cpp @@ -2,22 +2,27 @@ void StorageCache::clear() { - m_queryToTokenIds.clear(); + m_graphForAll.reset(); + + m_storageStats = StorageStats(); } -std::vector StorageCache::getTokenIdsForMatches(const std::vector& matches) const +std::shared_ptr StorageCache::getGraphForAll() const { - std::string query = SearchMatch::searchMatchesToString(matches); - std::map>::const_iterator it = m_queryToTokenIds.find(query); - - if (it != m_queryToTokenIds.end()) + if (!m_graphForAll) { - return it->second; + m_graphForAll = StorageAccessProxy::getGraphForAll(); } - std::vector ids = StorageAccessProxy::getTokenIdsForMatches(matches); + return m_graphForAll; +} - m_queryToTokenIds.emplace(query, ids); +StorageStats StorageCache::getStorageStats() const +{ + if (!m_storageStats.nodeCount) + { + m_storageStats = StorageAccessProxy::getStorageStats(); + } - return ids; + return m_storageStats; } diff --git a/src/lib/data/StorageCache.h b/src/lib/data/StorageCache.h index 1d4f5587..95a38c80 100644 --- a/src/lib/data/StorageCache.h +++ b/src/lib/data/StorageCache.h @@ -11,10 +11,13 @@ class StorageCache public: void clear(); - virtual std::vector getTokenIdsForMatches(const std::vector& matches) const; + virtual std::shared_ptr getGraphForAll() const; + + virtual StorageStats getStorageStats() const; private: - mutable std::map> m_queryToTokenIds; + mutable std::shared_ptr m_graphForAll; + mutable StorageStats m_storageStats; }; #endif // STORAGE_CACHE_H diff --git a/src/lib/data/StorageStats.h b/src/lib/data/StorageStats.h index e9c18efe..695a47e6 100644 --- a/src/lib/data/StorageStats.h +++ b/src/lib/data/StorageStats.h @@ -1,8 +1,6 @@ #ifndef STORAGE_STATS_H #define STORAGE_STATS_H -#include "data/ErrorCountInfo.h" - struct StorageStats { StorageStats() @@ -10,7 +8,6 @@ struct StorageStats , edgeCount(0) , fileCount(0) , fileLOCCount(0) - , errorCount(ErrorCountInfo()) {} size_t nodeCount; @@ -18,8 +15,6 @@ struct StorageStats size_t fileCount; size_t fileLOCCount; - - ErrorCountInfo errorCount; }; #endif // STORAGE_STATS_H