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:
@@ -286,7 +286,7 @@ void CodeController::handleMessage(MessageChangeFileView* message)
|
|||||||
|
|
||||||
if (message->needsData && !message->filePath.empty())
|
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);
|
view->setFileState(message->filePath, state);
|
||||||
|
|||||||
@@ -7,14 +7,19 @@
|
|||||||
#include "MessageIndexingStatus.h"
|
#include "MessageIndexingStatus.h"
|
||||||
#include "MessageShowStatus.h"
|
#include "MessageShowStatus.h"
|
||||||
#include "MessageStatus.h"
|
#include "MessageStatus.h"
|
||||||
|
#include "PersistentStorage.h"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
#include "utilityApp.h"
|
#include "utilityApp.h"
|
||||||
#include "utilityString.h"
|
#include "utilityString.h"
|
||||||
|
|
||||||
TaskExecuteCustomCommands::TaskExecuteCustomCommands(
|
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_indexerCommandProvider(std::move(indexerCommandProvider))
|
||||||
|
, m_storage(storage)
|
||||||
, m_dialogView(dialogView)
|
, m_dialogView(dialogView)
|
||||||
, m_projectDirectory(projectDirectory)
|
, m_projectDirectory(projectDirectory)
|
||||||
{
|
{
|
||||||
@@ -48,9 +53,13 @@ Task::TaskState TaskExecuteCustomCommands::doUpdate(std::shared_ptr<Blackboard>
|
|||||||
MessageIndexingStatus(true, indexedSourceFileCount * 100 / sourceFileCount).dispatch();
|
MessageIndexingStatus(true, indexedSourceFileCount * 100 / sourceFileCount).dispatch();
|
||||||
LOG_INFO_STREAM(<< "Execute command \"" << utility::encodeToUtf8(indexerCommand->getCustomCommand()) << "\"");
|
LOG_INFO_STREAM(<< "Execute command \"" << utility::encodeToUtf8(indexerCommand->getCustomCommand()) << "\"");
|
||||||
|
|
||||||
|
m_storage->beforeErrorRecording();
|
||||||
|
|
||||||
std::wstring processOutput;
|
std::wstring processOutput;
|
||||||
int result = utility::executeProcessAndGetExitCode(indexerCommand->getCustomCommand(), {}, m_projectDirectory, -1, &processOutput);
|
int result = utility::executeProcessAndGetExitCode(indexerCommand->getCustomCommand(), {}, m_projectDirectory, -1, &processOutput);
|
||||||
|
|
||||||
|
m_storage->afterErrorRecording();
|
||||||
|
|
||||||
if (processOutput.size() > 3 || result != 0)
|
if (processOutput.size() > 3 || result != 0)
|
||||||
{
|
{
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
class DialogView;
|
class DialogView;
|
||||||
class IndexerCommandProvider;
|
class IndexerCommandProvider;
|
||||||
|
class PersistentStorage;
|
||||||
|
|
||||||
class TaskExecuteCustomCommands
|
class TaskExecuteCustomCommands
|
||||||
: public Task
|
: public Task
|
||||||
@@ -19,6 +20,7 @@ class TaskExecuteCustomCommands
|
|||||||
public:
|
public:
|
||||||
TaskExecuteCustomCommands(
|
TaskExecuteCustomCommands(
|
||||||
std::unique_ptr<IndexerCommandProvider> indexerCommandProvider,
|
std::unique_ptr<IndexerCommandProvider> indexerCommandProvider,
|
||||||
|
std::shared_ptr<PersistentStorage> storage,
|
||||||
std::shared_ptr<DialogView> dialogView,
|
std::shared_ptr<DialogView> dialogView,
|
||||||
const FilePath& projectDirectory);
|
const FilePath& projectDirectory);
|
||||||
|
|
||||||
@@ -31,6 +33,7 @@ private:
|
|||||||
void handleMessage(MessageIndexingInterrupted* message) override;
|
void handleMessage(MessageIndexingInterrupted* message) override;
|
||||||
|
|
||||||
std::unique_ptr<IndexerCommandProvider> m_indexerCommandProvider;
|
std::unique_ptr<IndexerCommandProvider> m_indexerCommandProvider;
|
||||||
|
std::shared_ptr<PersistentStorage> m_storage;
|
||||||
std::shared_ptr<DialogView> m_dialogView;
|
std::shared_ptr<DialogView> m_dialogView;
|
||||||
const FilePath m_projectDirectory;
|
const FilePath m_projectDirectory;
|
||||||
|
|
||||||
|
|||||||
@@ -195,13 +195,7 @@ const std::vector<StorageError>& PersistentStorage::getErrors() const
|
|||||||
|
|
||||||
void PersistentStorage::startInjection()
|
void PersistentStorage::startInjection()
|
||||||
{
|
{
|
||||||
m_preInjectionErrorCount = m_sqliteIndexStorage.getErrorCount();
|
beforeErrorRecording();
|
||||||
|
|
||||||
if (!m_preIndexingErrorCountSet)
|
|
||||||
{
|
|
||||||
m_preIndexingErrorCount = m_preInjectionErrorCount;
|
|
||||||
m_preIndexingErrorCountSet = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_sqliteIndexStorage.beginTransaction();
|
m_sqliteIndexStorage.beginTransaction();
|
||||||
}
|
}
|
||||||
@@ -210,6 +204,22 @@ void PersistentStorage::finishInjection()
|
|||||||
{
|
{
|
||||||
m_sqliteIndexStorage.commitTransaction();
|
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();
|
std::vector<ErrorInfo> errors = m_sqliteIndexStorage.getAllErrorInfos();
|
||||||
if (m_preInjectionErrorCount < errors.size())
|
if (m_preInjectionErrorCount < errors.size())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ public:
|
|||||||
void startInjection() override;
|
void startInjection() override;
|
||||||
void finishInjection() override;
|
void finishInjection() override;
|
||||||
|
|
||||||
|
void beforeErrorRecording();
|
||||||
|
void afterErrorRecording();
|
||||||
|
|
||||||
void setMode(const SqliteIndexStorage::StorageModeType mode);
|
void setMode(const SqliteIndexStorage::StorageModeType mode);
|
||||||
|
|
||||||
FilePath getIndexDbFilePath() const;
|
FilePath getIndexDbFilePath() const;
|
||||||
|
|||||||
@@ -617,7 +617,7 @@ void Project::buildIndex(RefreshInfo info, std::shared_ptr<DialogView> dialogVie
|
|||||||
{
|
{
|
||||||
taskSequential->addTask(
|
taskSequential->addTask(
|
||||||
std::make_shared<TaskExecuteCustomCommands>(
|
std::make_shared<TaskExecuteCustomCommands>(
|
||||||
std::move(customIndexerCommandProvider), dialogView, getProjectSettingsFilePath().getParentDirectory())
|
std::move(customIndexerCommandProvider), tempStorage, dialogView, getProjectSettingsFilePath().getParentDirectory())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user