logic: error limit and better user experience (issue #385)

* only show up to 1000 errors in table and code view
* click button in bottom right of error table to show all
* same error order in code and table
* highlight error line when switching reference in code view
* improved error view performance

bug id = 385
This commit is contained in:
Eberhard Graether
2017-05-30 23:11:20 +02:00
parent a34abe6b4b
commit 29cfbe0f66
20 changed files with 204 additions and 75 deletions
+39 -8
View File
@@ -417,7 +417,10 @@ void PersistentStorage::finishInjection()
if (m_preInjectionErrorCount != errors.size())
{
MessageNewErrors(std::vector<ErrorInfo>(errors.begin() + m_preInjectionErrorCount, errors.end())).dispatchImmediately();
MessageNewErrors(
std::vector<ErrorInfo>(errors.begin() + m_preInjectionErrorCount, errors.end()),
getErrorCount(errors)
).dispatch();
}
}
@@ -1424,10 +1427,14 @@ StorageStats PersistentStorage::getStorageStats() const
}
ErrorCountInfo PersistentStorage::getErrorCount() const
{
return getErrorCount(getErrors());
}
ErrorCountInfo PersistentStorage::getErrorCount(const std::vector<ErrorInfo>& errors) const
{
ErrorCountInfo info;
std::vector<ErrorInfo> errors = getErrors();
for (const ErrorInfo& error : errors)
{
info.total++;
@@ -1443,21 +1450,40 @@ ErrorCountInfo PersistentStorage::getErrorCount() const
std::vector<ErrorInfo> PersistentStorage::getErrors() const
{
std::vector<ErrorInfo> errors = m_sqliteIndexStorage.getAll<StorageError>();
std::vector<ErrorInfo> filteredErrors;
std::vector<ErrorInfo> errors;
for (const ErrorInfo& error : errors)
for (const ErrorInfo& error : m_sqliteIndexStorage.getAll<StorageError>())
{
if (m_errorFilter.filter(error))
{
filteredErrors.push_back(error);
errors.push_back(error);
}
}
return filteredErrors;
return errors;
}
std::shared_ptr<SourceLocationCollection> PersistentStorage::getErrorSourceLocations(std::vector<ErrorInfo>* errors) const
std::vector<ErrorInfo> PersistentStorage::getErrorsLimited() const
{
std::vector<ErrorInfo> errors;
for (const ErrorInfo& error : m_sqliteIndexStorage.getAll<StorageError>())
{
if (m_errorFilter.filter(error))
{
errors.push_back(error);
}
if (m_errorFilter.limit > 0 && errors.size() >= m_errorFilter.limit)
{
break;
}
}
return errors;
}
std::shared_ptr<SourceLocationCollection> PersistentStorage::getErrorSourceLocationsLimited(std::vector<ErrorInfo>* errors) const
{
TRACE();
@@ -1482,6 +1508,11 @@ std::shared_ptr<SourceLocationCollection> PersistentStorage::getErrorSourceLocat
error.columnNumber
);
}
if (m_errorFilter.limit > 0 && errors->size() >= m_errorFilter.limit)
{
break;
}
}
addCompleteFlagsToSourceLocationCollection(collection.get());