logic: Show error updates during custom command indexing

* fixed code view showing all locations when switching view mode while showing errors
This commit is contained in:
Eberhard Graether
2018-12-17 00:27:16 +01:00
parent dd4a880ec3
commit 797bf2fee5
6 changed files with 35 additions and 10 deletions
@@ -286,7 +286,7 @@ void CodeController::handleMessage(MessageChangeFileView* message)
if (message->needsData && !message->filePath.empty())
{
showCodeSnippets(getSnippetsForFileWithState(message->filePath, state), CodeView::CodeParams());
showCodeSnippets(getSnippetsForFileWithState(message->filePath, state), CodeView::CodeParams(), !message->showErrors);
}
view->setFileState(message->filePath, state);
@@ -7,14 +7,19 @@
#include "MessageIndexingStatus.h"
#include "MessageShowStatus.h"
#include "MessageStatus.h"
#include "PersistentStorage.h"
#include "utility.h"
#include "utilityApp.h"
#include "utilityString.h"
TaskExecuteCustomCommands::TaskExecuteCustomCommands(
std::unique_ptr<IndexerCommandProvider> indexerCommandProvider, std::shared_ptr<DialogView> dialogView, const FilePath& projectDirectory
std::unique_ptr<IndexerCommandProvider> indexerCommandProvider,
std::shared_ptr<PersistentStorage> storage,
std::shared_ptr<DialogView> dialogView,
const FilePath& projectDirectory
)
: m_indexerCommandProvider(std::move(indexerCommandProvider))
, m_storage(storage)
, m_dialogView(dialogView)
, m_projectDirectory(projectDirectory)
{
@@ -48,9 +53,13 @@ Task::TaskState TaskExecuteCustomCommands::doUpdate(std::shared_ptr<Blackboard>
MessageIndexingStatus(true, indexedSourceFileCount * 100 / sourceFileCount).dispatch();
LOG_INFO_STREAM(<< "Execute command \"" << utility::encodeToUtf8(indexerCommand->getCustomCommand()) << "\"");
m_storage->beforeErrorRecording();
std::wstring processOutput;
int result = utility::executeProcessAndGetExitCode(indexerCommand->getCustomCommand(), {}, m_projectDirectory, -1, &processOutput);
m_storage->afterErrorRecording();
if (processOutput.size() > 3 || result != 0)
{
if (result == 0)
@@ -11,6 +11,7 @@
class DialogView;
class IndexerCommandProvider;
class PersistentStorage;
class TaskExecuteCustomCommands
: public Task
@@ -19,6 +20,7 @@ class TaskExecuteCustomCommands
public:
TaskExecuteCustomCommands(
std::unique_ptr<IndexerCommandProvider> indexerCommandProvider,
std::shared_ptr<PersistentStorage> storage,
std::shared_ptr<DialogView> dialogView,
const FilePath& projectDirectory);
@@ -31,6 +33,7 @@ private:
void handleMessage(MessageIndexingInterrupted* message) override;
std::unique_ptr<IndexerCommandProvider> m_indexerCommandProvider;
std::shared_ptr<PersistentStorage> m_storage;
std::shared_ptr<DialogView> m_dialogView;
const FilePath m_projectDirectory;
+17 -7
View File
@@ -195,13 +195,7 @@ const std::vector<StorageError>& PersistentStorage::getErrors() const
void PersistentStorage::startInjection()
{
m_preInjectionErrorCount = m_sqliteIndexStorage.getErrorCount();
if (!m_preIndexingErrorCountSet)
{
m_preIndexingErrorCount = m_preInjectionErrorCount;
m_preIndexingErrorCountSet = true;
}
beforeErrorRecording();
m_sqliteIndexStorage.beginTransaction();
}
@@ -210,6 +204,22 @@ void PersistentStorage::finishInjection()
{
m_sqliteIndexStorage.commitTransaction();
afterErrorRecording();
}
void PersistentStorage::beforeErrorRecording()
{
m_preInjectionErrorCount = m_sqliteIndexStorage.getErrorCount();
if (!m_preIndexingErrorCountSet)
{
m_preIndexingErrorCount = m_preInjectionErrorCount;
m_preIndexingErrorCountSet = true;
}
}
void PersistentStorage::afterErrorRecording()
{
std::vector<ErrorInfo> errors = m_sqliteIndexStorage.getAllErrorInfos();
if (m_preInjectionErrorCount < errors.size())
{
+3
View File
@@ -49,6 +49,9 @@ public:
void startInjection() override;
void finishInjection() override;
void beforeErrorRecording();
void afterErrorRecording();
void setMode(const SqliteIndexStorage::StorageModeType mode);
FilePath getIndexDbFilePath() const;
+1 -1
View File
@@ -617,7 +617,7 @@ void Project::buildIndex(RefreshInfo info, std::shared_ptr<DialogView> dialogVie
{
taskSequential->addTask(
std::make_shared<TaskExecuteCustomCommands>(
std::move(customIndexerCommandProvider), dialogView, getProjectSettingsFilePath().getParentDirectory())
std::move(customIndexerCommandProvider), tempStorage, dialogView, getProjectSettingsFilePath().getParentDirectory())
);
}