logic: shallow python indexing (issue #725)

This commit is contained in:
mlangkabel
2019-11-06 19:50:47 +01:00
parent 73f3be72e1
commit 9d556599ab
37 changed files with 284 additions and 98 deletions
+2 -2
View File
@@ -42,7 +42,7 @@ void DialogView::hideProgressDialog()
}
void DialogView::startIndexingDialog(
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode,
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode, bool enabledShallowOption, bool shallow,
std::function<void(const RefreshInfo& info)> onStartIndexing, std::function<void()> onCancelIndexing)
{
}
@@ -59,7 +59,7 @@ void DialogView::updateCustomIndexingDialog(
DatabasePolicy DialogView::finishedIndexingDialog(
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
float time, ErrorCountInfo errorInfo, bool interrupted)
float time, ErrorCountInfo errorInfo, bool interrupted, bool shallow)
{
return DATABASE_POLICY_KEEP; // used in non-gui mode
}
+3 -2
View File
@@ -15,6 +15,7 @@ enum DatabasePolicy
{
DATABASE_POLICY_KEEP,
DATABASE_POLICY_DISCARD,
DATABASE_POLICY_REFRESH,
DATABASE_POLICY_UNKNOWN
};
@@ -45,7 +46,7 @@ public:
virtual void hideProgressDialog();
virtual void startIndexingDialog(
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode,
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode, bool enabledShallowOption, bool shallow,
std::function<void(const RefreshInfo& info)> onStartIndexing, std::function<void()> onCancelIndexing);
virtual void updateIndexingDialog(
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths);
@@ -53,7 +54,7 @@ public:
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths);
virtual DatabasePolicy finishedIndexingDialog(
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
float time, ErrorCountInfo errorInfo, bool interrupted);
float time, ErrorCountInfo errorInfo, bool interrupted, bool shallow);
int confirm(const std::wstring& message);
virtual int confirm(const std::wstring& message, const std::vector<std::wstring>& options);
+10 -1
View File
@@ -61,6 +61,9 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
bool interruptedIndexing = false;
blackboard->get("interrupted_indexing", interruptedIndexing);
bool shallowIndexing = false;
blackboard->get("shallow_indexing", shallowIndexing);
ErrorCountInfo errorInfo = m_storage->getErrorCount();
std::wstring status;
@@ -82,7 +85,8 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
stats.fileCount,
time,
errorInfo,
interruptedIndexing
interruptedIndexing,
shallowIndexing
);
MessageIndexingStatus(false).dispatch();
@@ -95,6 +99,11 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
{
blackboard->set("discard_database", true);
}
else if (policy == DATABASE_POLICY_REFRESH)
{
blackboard->set("keep_database", true);
blackboard->set("refresh_database", true);
}
return STATE_SUCCESS;
}
@@ -260,7 +260,7 @@ void TaskExecuteCustomCommands::runPythonPostProcessing(PersistentStorage& stora
std::vector<Id> unsolvedLocationIds;
for (const StorageSourceLocation location : storage.getStorageSourceLocations())
{
if (intToLocationType(location.type) == LOCATION_UNSOLVED)
if (intToLocationType(location.type) == LOCATION_UNSOLVED) // FIXME: this doesn't catch unsolved qualifiers -> convert Qualifier location type to qualifier edge
{
unsolvedLocationIds.push_back(location.id);
}
@@ -286,9 +286,9 @@ void TaskExecuteCustomCommands::runPythonPostProcessing(PersistentStorage& stora
storage.setMode(SqliteIndexStorage::STORAGE_MODE_READ);
std::vector<DataToInsert> dataToInsert;
std::set<Id> elementsToDelete;
std::vector<StorageOccurrence> occurrencesToDelete;
locationCollection->forEachSourceLocationFile(
[&nodeNameToStorageNodes, &storage, &dataToInsert, &elementsToDelete](std::shared_ptr<SourceLocationFile> locationFile)
[&nodeNameToStorageNodes, &storage, &dataToInsert, &occurrencesToDelete](std::shared_ptr<SourceLocationFile> locationFile)
{
const FilePath filePath = locationFile->getFilePath();
if (filePath.empty())
@@ -305,7 +305,7 @@ void TaskExecuteCustomCommands::runPythonPostProcessing(PersistentStorage& stora
if (textAccess)
{
locationFile->forEachStartSourceLocation(
[textAccess, &nodeNameToStorageNodes, &storage, &dataToInsert, &elementsToDelete](const SourceLocation* startLoc)
[textAccess, &nodeNameToStorageNodes, &storage, &dataToInsert, &occurrencesToDelete](const SourceLocation* startLoc)
{
if (!startLoc)
{
@@ -319,23 +319,20 @@ void TaskExecuteCustomCommands::runPythonPostProcessing(PersistentStorage& stora
const std::wstring token = utility::decodeFromUtf8(textAccess->getLine(startLoc->getLineNumber()).substr(startLoc->getColumnNumber() - 1, endLoc->getColumnNumber() - startLoc->getColumnNumber() + 1));
for (const Id tokenId : startLoc->getTokenIds())
for (const Id elementId : startLoc->getTokenIds())
{
const StorageEdge edge = storage.getEdgeById(tokenId);
const StorageEdge edge = storage.getEdgeById(elementId);
if (edge.id != 0)
{
for (const StorageNode& targetNode : nodeNameToStorageNodes[token])
{
if (Edge::intToType(edge.type) == Edge::EDGE_CALL &&
(
NodeType::intToType(targetNode.type) != NodeType::NODE_FUNCTION ||
NodeType::intToType(targetNode.type) != NodeType::NODE_METHOD
)
){
if (Edge::intToType(edge.type) == Edge::EDGE_INHERITANCE &&
NodeType::intToType(targetNode.type) != NodeType::NODE_CLASS)
{
continue;
}
dataToInsert.push_back({ StorageEdgeData(edge.type, edge.sourceNodeId, targetNode.id) , startLoc->getLocationId() });
elementsToDelete.insert(edge.id);
occurrencesToDelete.push_back(StorageOccurrence(edge.id, startLoc->getLocationId()));
}
}
}
@@ -364,7 +361,15 @@ void TaskExecuteCustomCommands::runPythonPostProcessing(PersistentStorage& stora
storage.addOccurrence(StorageOccurrence(ambiguousEdgeIds[i], dataToInsert[i].sourceLocationId));
}
storage.setMode(SqliteIndexStorage::STORAGE_MODE_CLEAR);
storage.removeElements(utility::toVector(elementsToDelete));
storage.removeOccurrences(occurrencesToDelete);
std::set<Id> edgeIds;
for (const StorageOccurrence& occurrence : occurrencesToDelete)
{
edgeIds.insert(occurrence.elementId);
}
storage.removeElementsWithoutOccurrences(utility::toVector(edgeIds));
storage.finishInjection();
LOG_INFO("Finished Python post processing.");
}
@@ -165,6 +165,21 @@ void PersistentStorage::removeElements(const std::vector<Id>& ids)
m_sqliteIndexStorage.removeElements(ids);
}
void PersistentStorage::removeOccurrence(const StorageOccurrence& occurrence)
{
m_sqliteIndexStorage.removeOccurrence(occurrence);
}
void PersistentStorage::removeOccurrences(const std::vector<StorageOccurrence>& occurrences)
{
m_sqliteIndexStorage.removeOccurrences(occurrences);
}
void PersistentStorage::removeElementsWithoutOccurrences(const std::vector<Id>& elementIds)
{
m_sqliteIndexStorage.removeElementsWithoutOccurrences(elementIds);
}
const std::vector<StorageNode>& PersistentStorage::getStorageNodes() const
{
return m_storageData.nodes = m_sqliteIndexStorage.getAll<StorageNode>();
+3
View File
@@ -40,6 +40,9 @@ public:
void removeElement(const Id id);
void removeElements(const std::vector<Id>& ids);
void removeOccurrence(const StorageOccurrence& occurrence);
void removeOccurrences(const std::vector<StorageOccurrence>& occurrences);
void removeElementsWithoutOccurrences(const std::vector<Id>& elementIds);
const std::vector<StorageNode>& getStorageNodes() const override;
const std::vector<StorageFile>& getStorageFiles() const override;
@@ -477,6 +477,28 @@ void SqliteIndexStorage::removeElements(const std::vector<Id>& ids)
);
}
void SqliteIndexStorage::removeOccurrence(const StorageOccurrence& occurrence)
{
executeStatement(
"DELETE FROM occurrence WHERE element_id = " + std::to_string(occurrence.elementId) + " AND source_location_id = " + std::to_string(occurrence.sourceLocationId) + ";"
);
}
void SqliteIndexStorage::removeOccurrences(const std::vector<StorageOccurrence>& occurrences)
{
for (const StorageOccurrence& occurrence : occurrences)
{
removeOccurrence(occurrence);
}
}
void SqliteIndexStorage::removeElementsWithoutOccurrences(const std::vector<Id>& elementIds)
{
executeStatement(
"DELETE FROM element WHERE id IN (" + utility::join(utility::toStrings(elementIds), ',') + ") AND id NOT IN (SELECT element_id FROM occurrence);"
);
}
void SqliteIndexStorage::removeElementsWithLocationInFiles(
const std::vector<Id>& fileIds, std::function<void(int)> updateStatusCallback)
{
@@ -72,6 +72,9 @@ public:
void removeElement(Id id);
void removeElements(const std::vector<Id>& ids);
void removeOccurrence(const StorageOccurrence& occurrence);
void removeOccurrences(const std::vector<StorageOccurrence>& occurrences);
void removeElementsWithoutOccurrences(const std::vector<Id>& elementIds);
void removeElementsWithLocationInFiles(const std::vector<Id>& fileIds, std::function<void(int)> updateStatusCallback);
void removeAllErrors();
+45 -10
View File
@@ -26,6 +26,7 @@
#include "FileSystem.h"
#include "MessageErrorCountClear.h"
#include "MessageIndexingFinished.h"
#include "MessageIndexingShowDialog.h"
#include "MessageIndexingStarted.h"
#include "MessageIndexingStatus.h"
#include "MessageRefresh.h"
@@ -73,14 +74,14 @@ bool Project::isLoaded() const
{
switch (m_state)
{
case PROJECT_STATE_EMPTY:
case PROJECT_STATE_LOADED:
case PROJECT_STATE_OUTDATED:
case PROJECT_STATE_NEEDS_MIGRATION:
return true;
case PROJECT_STATE_EMPTY:
case PROJECT_STATE_LOADED:
case PROJECT_STATE_OUTDATED:
case PROJECT_STATE_NEEDS_MIGRATION:
return true;
default:
break;
default:
break;
}
return false;
@@ -354,6 +355,18 @@ void Project::refresh(RefreshMode refreshMode, std::shared_ptr<DialogView> dialo
refreshMode = REFRESH_UPDATED_FILES;
}
bool allowsShallowIndexing = false;
for (const std::shared_ptr<SourceGroup>& sourceGroup : m_sourceGroups)
{
if (sourceGroup->getStatus() == SOURCE_GROUP_STATUS_ENABLED && sourceGroup->allowsShallowIndexing())
{
allowsShallowIndexing = true;
break;
}
}
const bool useShallowIndexing = allowsShallowIndexing && (!isLoaded() || m_state == PROJECT_STATE_EMPTY);
if (m_hasGUI)
{
std::vector<RefreshMode> enabledModes = { REFRESH_ALL_FILES };
@@ -362,7 +375,7 @@ void Project::refresh(RefreshMode refreshMode, std::shared_ptr<DialogView> dialo
enabledModes.insert(enabledModes.end(), { REFRESH_UPDATED_FILES, REFRESH_UPDATED_AND_INCOMPLETE_FILES });
}
dialogView->startIndexingDialog(this, enabledModes, refreshMode,
dialogView->startIndexingDialog(this, enabledModes, refreshMode, allowsShallowIndexing, useShallowIndexing,
[this, dialogView](const RefreshInfo& info)
{
buildIndex(info, dialogView);
@@ -453,7 +466,9 @@ void Project::buildIndex(RefreshInfo info, std::shared_ptr<DialogView> dialogVie
}
else
{
const bool shallow = info.shallow;
info = getRefreshInfo(REFRESH_ALL_FILES);
info.shallow = shallow;
}
}
@@ -476,6 +491,7 @@ void Project::buildIndex(RefreshInfo info, std::shared_ptr<DialogView> dialogVie
if (info.mode != REFRESH_ALL_FILES)
{
// store the indexed data into the temp db but keep the current state to allow browsing while indexing
FileSystem::copyFile(indexDbFilePath, tempIndexDbFilePath);
}
@@ -507,17 +523,18 @@ void Project::buildIndex(RefreshInfo info, std::shared_ptr<DialogView> dialogVie
if (sourceGroup->getType() == SOURCE_GROUP_CUSTOM_COMMAND ||
sourceGroup->getType() == SOURCE_GROUP_PYTHON_EMPTY)
{
customIndexerCommandProvider->addProvider(sourceGroup->getIndexerCommandProvider(info.filesToIndex));
customIndexerCommandProvider->addProvider(sourceGroup->getIndexerCommandProvider(info));
}
else
{
indexerCommandProvider->addProvider(sourceGroup->getIndexerCommandProvider(info.filesToIndex));
indexerCommandProvider->addProvider(sourceGroup->getIndexerCommandProvider(info));
}
}
}
size_t sourceFileCount = indexerCommandProvider->size() + customIndexerCommandProvider->size();
taskSequential->addTask(std::make_shared<TaskSetValue<bool>>("shallow_indexing", info.shallow));
taskSequential->addTask(std::make_shared<TaskSetValue<int>>("source_file_count", sourceFileCount));
taskSequential->addTask(std::make_shared<TaskSetValue<int>>("indexed_source_file_count", 0));
taskSequential->addTask(std::make_shared<TaskSetValue<bool>>("interrupted_indexing", false));
@@ -670,6 +687,24 @@ void Project::buildIndex(RefreshInfo info, std::shared_ptr<DialogView> dialogVie
MessageIndexingFinished().dispatch();
}));
taskSequential->addTask(std::make_shared<TaskGroupSelector>()->addChildTasks(
std::make_shared<TaskGroupSequence>()->addChildTasks(
std::make_shared<TaskFindKeyOnBlackboard>("refresh_database"),
std::make_shared<TaskLambda>([dialogView, this]() {
Task::dispatch(TabId::app(), std::make_shared<TaskLambda>([dialogView, this]() {
MessageIndexingShowDialog().dispatch();
MessageRefresh().refreshAll().dispatch();
}));
})
),
std::make_shared<TaskGroupSequence>()->addChildTasks(
std::make_shared<TaskLambda>([this]() {
Task::dispatch(TabId::app(), std::make_shared<TaskLambda>([this]() {
}));
})
)
));
taskSequential->setIsBackgroundTask(true);
Task::dispatch(TabId::app(), taskSequential);
+1
View File
@@ -20,6 +20,7 @@ struct RefreshInfo
std::set<FilePath> nonIndexedFilesToClear;
RefreshMode mode = REFRESH_NONE;
bool shallow = true;
};
#endif // REFRESH_INFO_H
+7 -2
View File
@@ -7,9 +7,9 @@
#include "SourceGroupSettings.h"
#include "TaskLambda.h"
std::shared_ptr<IndexerCommandProvider> SourceGroup::getIndexerCommandProvider(const std::set<FilePath>& filesToIndex) const
std::shared_ptr<IndexerCommandProvider> SourceGroup::getIndexerCommandProvider(const RefreshInfo& info) const
{
return std::make_shared<MemoryIndexerCommandProvider>(getIndexerCommands(filesToIndex));
return std::make_shared<MemoryIndexerCommandProvider>(getIndexerCommands(info));
}
std::shared_ptr<Task> SourceGroup::getPreIndexTask(
@@ -43,6 +43,11 @@ bool SourceGroup::allowsPartialClearing() const
return true;
}
bool SourceGroup::allowsShallowIndexing() const
{
return false;
}
std::set<FilePath> SourceGroup::filterToContainedSourceFilePath(const std::set<FilePath>& sourceFilePaths) const
{
std::set<FilePath> filteredSourceFilePaths;
+5 -2
View File
@@ -18,6 +18,8 @@ class SourceGroupSettings;
class StorageProvider;
class Task;
struct RefreshInfo;
class SourceGroup
{
public:
@@ -25,11 +27,12 @@ public:
virtual bool prepareIndexing();
virtual bool allowsPartialClearing() const;
virtual bool allowsShallowIndexing() const;
virtual std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const = 0;
virtual std::set<FilePath> getAllSourceFilePaths() const = 0;
virtual std::shared_ptr<IndexerCommandProvider> getIndexerCommandProvider(const std::set<FilePath>& filesToIndex) const;
virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const = 0;
virtual std::shared_ptr<IndexerCommandProvider> getIndexerCommandProvider(const RefreshInfo& info) const;
virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const RefreshInfo& info) const = 0;
virtual std::shared_ptr<Task> getPreIndexTask(
std::shared_ptr<StorageProvider> storageProvider, std::shared_ptr<DialogView> dialogView) const;
+3 -2
View File
@@ -3,6 +3,7 @@
#include "FileManager.h"
#include "IndexerCommandCustom.h"
#include "ProjectSettings.h"
#include "RefreshInfo.h"
#include "SourceGroupSettingsCustomCommand.h"
#include "SqliteIndexStorage.h"
#include "utility.h"
@@ -38,7 +39,7 @@ std::set<FilePath> SourceGroupCustomCommand::getAllSourceFilePaths() const
return fileManager.getAllSourceFilePaths();
}
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCustomCommand::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCustomCommand::getIndexerCommands(const RefreshInfo& info) const
{
const std::wstring customCommand = m_settings->getCustomCommand();
const bool runInParallel = m_settings->getRunInParallel();
@@ -46,7 +47,7 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCustomCommand::getIndexe
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
for (const FilePath& sourcePath: getAllSourceFilePaths())
{
if (filesToIndex.find(sourcePath) != filesToIndex.end())
if (info.filesToIndex.find(sourcePath) != info.filesToIndex.end())
{
indexerCommands.push_back(std::make_shared<IndexerCommandCustom>(
customCommand,
+1 -1
View File
@@ -18,7 +18,7 @@ public:
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
std::set<FilePath> getAllSourceFilePaths() const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const RefreshInfo& info) const override;
private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
+4 -4
View File
@@ -80,7 +80,7 @@ std::set<FilePath> SourceGroupCxxCdb::getAllSourceFilePaths(std::shared_ptr<clan
return sourceFilePaths;
}
std::shared_ptr<IndexerCommandProvider> SourceGroupCxxCdb::getIndexerCommandProvider(const std::set<FilePath>& filesToIndex) const
std::shared_ptr<IndexerCommandProvider> SourceGroupCxxCdb::getIndexerCommandProvider(const RefreshInfo& info) const
{
std::shared_ptr<CxxIndexerCommandProvider> provider = std::make_shared<CxxIndexerCommandProvider>();
@@ -112,7 +112,7 @@ std::shared_ptr<IndexerCommandProvider> SourceGroupCxxCdb::getIndexerCommandProv
}
}
if (filesToIndex.find(sourcePath) != filesToIndex.end() &&
if (info.filesToIndex.find(sourcePath) != info.filesToIndex.end() &&
sourceFilePaths.find(sourcePath) != sourceFilePaths.end())
{
std::vector<std::wstring> cdbFlags = utility::convert<std::string, std::wstring>(
@@ -143,9 +143,9 @@ std::shared_ptr<IndexerCommandProvider> SourceGroupCxxCdb::getIndexerCommandProv
return provider;
}
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxCdb::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxCdb::getIndexerCommands(const RefreshInfo& info) const
{
return getIndexerCommandProvider(filesToIndex)->consumeAllCommands();
return getIndexerCommandProvider(info)->consumeAllCommands();
}
std::shared_ptr<Task> SourceGroupCxxCdb::getPreIndexTask(
+2 -2
View File
@@ -25,8 +25,8 @@ public:
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
std::set<FilePath> getAllSourceFilePaths() const override;
std::set<FilePath> getAllSourceFilePaths(std::shared_ptr<clang::tooling::JSONCompilationDatabase> cdb) const;
std::shared_ptr<IndexerCommandProvider> getIndexerCommandProvider(const std::set<FilePath>& filesToIndex) const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override;
std::shared_ptr<IndexerCommandProvider> getIndexerCommandProvider(const RefreshInfo& info) const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const RefreshInfo& info) const override;
std::shared_ptr<Task> getPreIndexTask(
std::shared_ptr<StorageProvider> storageProvider, std::shared_ptr<DialogView> dialogView) const override;
@@ -68,7 +68,7 @@ std::set<FilePath> SourceGroupCxxCodeblocks::getAllSourceFilePaths() const
return sourceFilePaths;
}
std::shared_ptr<IndexerCommandProvider> SourceGroupCxxCodeblocks::getIndexerCommandProvider(const std::set<FilePath>& filesToIndex) const
std::shared_ptr<IndexerCommandProvider> SourceGroupCxxCodeblocks::getIndexerCommandProvider(const RefreshInfo& info) const
{
std::shared_ptr<CxxIndexerCommandProvider> provider = std::make_shared<CxxIndexerCommandProvider>();
@@ -78,7 +78,7 @@ std::shared_ptr<IndexerCommandProvider> SourceGroupCxxCodeblocks::getIndexerComm
{
for (std::shared_ptr<IndexerCommandCxx> indexerCommand: project->getIndexerCommands(m_settings, ApplicationSettings::getInstance()))
{
if (filesToIndex.find(indexerCommand->getSourceFilePath()) != filesToIndex.end())
if (info.filesToIndex.find(indexerCommand->getSourceFilePath()) != info.filesToIndex.end())
{
provider->addCommand(indexerCommand);
}
@@ -87,9 +87,9 @@ std::shared_ptr<IndexerCommandProvider> SourceGroupCxxCodeblocks::getIndexerComm
return provider;
}
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxCodeblocks::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxCodeblocks::getIndexerCommands(const RefreshInfo& info) const
{
return getIndexerCommandProvider(filesToIndex)->consumeAllCommands();
return getIndexerCommandProvider(info)->consumeAllCommands();
}
std::shared_ptr<SourceGroupSettings> SourceGroupCxxCodeblocks::getSourceGroupSettings()
@@ -17,8 +17,8 @@ public:
bool prepareIndexing() override;
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
std::set<FilePath> getAllSourceFilePaths() const override;
std::shared_ptr<IndexerCommandProvider> getIndexerCommandProvider(const std::set<FilePath>& filesToIndex) const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override;
std::shared_ptr<IndexerCommandProvider> getIndexerCommandProvider(const RefreshInfo& info) const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const RefreshInfo& info) const override;
private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
+5 -4
View File
@@ -5,6 +5,7 @@
#include "FileManager.h"
#include "IndexerCommandCxx.h"
#include "logging.h"
#include "RefreshInfo.h"
#include "SourceGroupSettingsCEmpty.h"
#include "SourceGroupSettingsCppEmpty.h"
#include "SourceGroupSettingsWithCppStandard.h"
@@ -69,7 +70,7 @@ std::set<FilePath> SourceGroupCxxEmpty::getAllSourceFilePaths() const
return fileManager.getAllSourceFilePaths();
}
std::shared_ptr<IndexerCommandProvider> SourceGroupCxxEmpty::getIndexerCommandProvider(const std::set<FilePath>& filesToIndex) const
std::shared_ptr<IndexerCommandProvider> SourceGroupCxxEmpty::getIndexerCommandProvider(const RefreshInfo& info) const
{
std::set<FilePath> indexedPaths;
std::set<FilePathFilter> excludeFilters;
@@ -93,7 +94,7 @@ std::shared_ptr<IndexerCommandProvider> SourceGroupCxxEmpty::getIndexerCommandPr
std::shared_ptr<CxxIndexerCommandProvider> provider = std::make_shared<CxxIndexerCommandProvider>();
for (const FilePath& sourcePath: getAllSourceFilePaths())
{
if (filesToIndex.find(sourcePath) != filesToIndex.end())
if (info.filesToIndex.find(sourcePath) != info.filesToIndex.end())
{
provider->addCommand(std::make_shared<IndexerCommandCxx>(
sourcePath,
@@ -109,9 +110,9 @@ std::shared_ptr<IndexerCommandProvider> SourceGroupCxxEmpty::getIndexerCommandPr
return provider;
}
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxEmpty::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxEmpty::getIndexerCommands(const RefreshInfo& info) const
{
return getIndexerCommandProvider(filesToIndex)->consumeAllCommands();
return getIndexerCommandProvider(info)->consumeAllCommands();
}
std::shared_ptr<Task> SourceGroupCxxEmpty::getPreIndexTask(
+2 -2
View File
@@ -16,8 +16,8 @@ public:
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
std::set<FilePath> getAllSourceFilePaths() const override;
std::shared_ptr<IndexerCommandProvider> getIndexerCommandProvider(const std::set<FilePath>& filesToIndex) const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override;
std::shared_ptr<IndexerCommandProvider> getIndexerCommandProvider(const RefreshInfo& info) const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const RefreshInfo& info) const override;
std::shared_ptr<Task> getPreIndexTask(
std::shared_ptr<StorageProvider> storageProvider, std::shared_ptr<DialogView> dialogView) const override;
@@ -1,13 +1,13 @@
#include "SourceGroupCxxSonargraph.h"
#include "Application.h"
#include "ApplicationSettings.h"
#include "CxxIndexerCommandProvider.h"
#include "IndexerCommandCxx.h"
#include "ApplicationSettings.h"
#include "SourceGroupSettingsCxxSonargraph.h"
#include "MessageStatus.h"
#include "SourceGroupSettingsCxxSonargraph.h"
#include "SonargraphProject.h"
#include "utility.h"
#include "Application.h"
SourceGroupCxxSonargraph::SourceGroupCxxSonargraph(std::shared_ptr<SourceGroupSettingsCxxSonargraph> settings)
: m_settings(settings)
@@ -55,7 +55,7 @@ std::set<FilePath> SourceGroupCxxSonargraph::getAllSourceFilePaths() const
return sourceFilePaths;
}
std::shared_ptr<IndexerCommandProvider> SourceGroupCxxSonargraph::getIndexerCommandProvider(const std::set<FilePath>& filesToIndex) const
std::shared_ptr<IndexerCommandProvider> SourceGroupCxxSonargraph::getIndexerCommandProvider(const RefreshInfo& info) const
{
std::shared_ptr<CxxIndexerCommandProvider> provider = std::make_shared<CxxIndexerCommandProvider>();
if (std::shared_ptr<Sonargraph::Project> project = Sonargraph::Project::load(
@@ -66,7 +66,7 @@ std::shared_ptr<IndexerCommandProvider> SourceGroupCxxSonargraph::getIndexerComm
{
if (std::shared_ptr<IndexerCommandCxx> indexerCommandCxx = std::dynamic_pointer_cast<IndexerCommandCxx>(indexerCommand))
{
if (filesToIndex.find(indexerCommand->getSourceFilePath()) != filesToIndex.end())
if (info.filesToIndex.find(indexerCommand->getSourceFilePath()) != info.filesToIndex.end())
{
provider->addCommand(indexerCommandCxx);
}
@@ -76,9 +76,9 @@ std::shared_ptr<IndexerCommandProvider> SourceGroupCxxSonargraph::getIndexerComm
return provider;
}
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxSonargraph::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxSonargraph::getIndexerCommands(const RefreshInfo& info) const
{
return getIndexerCommandProvider(filesToIndex)->consumeAllCommands();
return getIndexerCommandProvider(info)->consumeAllCommands();
}
std::shared_ptr<SourceGroupSettings> SourceGroupCxxSonargraph::getSourceGroupSettings()
@@ -17,8 +17,8 @@ public:
bool prepareIndexing() override;
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
std::set<FilePath> getAllSourceFilePaths() const override;
std::shared_ptr<IndexerCommandProvider> getIndexerCommandProvider(const std::set<FilePath>& filesToIndex) const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override;
std::shared_ptr<IndexerCommandProvider> getIndexerCommandProvider(const RefreshInfo& info) const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const RefreshInfo& info) const override;
private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
@@ -372,7 +372,7 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
addTitle("Python", layout, row);
m_pythonPostProcessing = addCheckBox("Post Processing",
"Add ambiguous edges for unsolved references",
"Add ambiguous edges for unsolved references (recommended)",
"<p>Enable a post processing step to solve unsolved references after the indexing is done. </p>"
"<p>These references will be marked \"ambiguous\" to indicate that some of these edges may never "
"be encountered during runtime of the indexed code because the post processing only relies on "
+21 -4
View File
@@ -138,10 +138,11 @@ void QtDialogView::hideProgressDialog()
}
void QtDialogView::startIndexingDialog(
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode,
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode, bool enabledShallowOption, bool initialShallowState,
std::function<void(const RefreshInfo& info)> onStartIndexing, std::function<void()> onCancelIndexing)
{
m_refreshInfos.clear();
m_shallowIndexingEnabled = initialShallowState;
m_onQtThread(
[=]()
@@ -149,7 +150,14 @@ void QtDialogView::startIndexingDialog(
m_dialogsVisible = true;
m_windowStack.clearWindows();
QtIndexingStartDialog* window = createWindow<QtIndexingStartDialog>(enabledModes, initialMode);
QtIndexingStartDialog* window = createWindow<QtIndexingStartDialog>(enabledModes, initialMode, enabledShallowOption, initialShallowState);
connect(window, &QtIndexingStartDialog::setShallowIndexing,
[=](bool enabled)
{
m_shallowIndexingEnabled = enabled;
}
);
std::function<void(RefreshMode)> onRefreshModeChanged = (
[=](RefreshMode refreshMode)
@@ -200,6 +208,7 @@ void QtDialogView::startIndexingDialog(
[=](RefreshMode refreshMode)
{
RefreshInfo info = m_refreshInfos.find(refreshMode)->second;
info.shallow = m_shallowIndexingEnabled;
Task::dispatch(TabId::app(), std::make_shared<TaskLambda>(
[=]()
{
@@ -288,7 +297,7 @@ void QtDialogView::updateCustomIndexingDialog(
DatabasePolicy QtDialogView::finishedIndexingDialog(
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
float time, ErrorCountInfo errorInfo, bool interrupted)
float time, ErrorCountInfo errorInfo, bool interrupted, bool shallow)
{
DatabasePolicy policy = DATABASE_POLICY_UNKNOWN;
m_resultReady = false;
@@ -299,7 +308,7 @@ DatabasePolicy QtDialogView::finishedIndexingDialog(
m_dialogsVisible = true;
m_windowStack.clearWindows();
QtIndexingReportDialog* window = createWindow<QtIndexingReportDialog>(indexedFileCount, totalIndexedFileCount, completedFileCount, totalFileCount, time, interrupted);
QtIndexingReportDialog* window = createWindow<QtIndexingReportDialog>(indexedFileCount, totalIndexedFileCount, completedFileCount, totalFileCount, time, interrupted, shallow);
window->updateErrorCount(errorInfo.total, errorInfo.fatal);
connect(window, &QtIndexingDialog::finished,
[this, &policy]()
@@ -317,6 +326,14 @@ DatabasePolicy QtDialogView::finishedIndexingDialog(
m_resultReady = true;
}
);
connect(window, &QtIndexingReportDialog::requestReindexing,
[this, &policy]()
{
setUIBlocked(false);
policy = DATABASE_POLICY_REFRESH;
m_resultReady = true;
}
);
m_mainWindow->hideWindowsTaskbarProgress();
setUIBlocked(true);
+3 -2
View File
@@ -37,7 +37,7 @@ public:
void hideProgressDialog() override;
void startIndexingDialog(
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode,
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode, bool enabledShallowOption, bool initialShallowState,
std::function<void(const RefreshInfo& info)> onStartIndexing, std::function<void()> onCancelIndexing) override;
void updateIndexingDialog(
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths) override;
@@ -45,7 +45,7 @@ public:
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths) override;
DatabasePolicy finishedIndexingDialog(
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
float time, ErrorCountInfo errorInfo, bool interrupted) override;
float time, ErrorCountInfo errorInfo, bool interrupted, bool shallow) override;
int confirm(const std::wstring& message, const std::vector<std::wstring>& options) override;
@@ -78,6 +78,7 @@ private:
QtThreadedLambdaFunctor m_onQtThread3;
std::map<RefreshMode, RefreshInfo> m_refreshInfos;
bool m_shallowIndexingEnabled;
bool m_resultReady;
bool m_uiBlocked = false;
@@ -4,10 +4,12 @@
#include <QPushButton>
#include "MessageErrorsHelpMessage.h"
#include "MessageIndexingShowDialog.h"
#include "MessageRefresh.h"
#include "TimeStamp.h"
QtIndexingReportDialog::QtIndexingReportDialog(
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, float time, bool interrupted, QWidget* parent)
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, float time, bool interrupted, bool shallow, QWidget* parent)
: QtIndexingDialog(true, parent)
, m_interrupted(interrupted)
{
@@ -17,6 +19,10 @@ QtIndexingReportDialog::QtIndexingReportDialog(
{
QtIndexingDialog::createTitleLabel("Interrupted Indexing", m_layout);
}
else if (shallow)
{
QtIndexingDialog::createTitleLabel("Finished Shallow Indexing", m_layout);
}
else
{
QtIndexingDialog::createTitleLabel("Finished Indexing", m_layout);
@@ -40,6 +46,14 @@ QtIndexingReportDialog::QtIndexingReportDialog(
m_layout->addStretch();
if (shallow)
{
createMessageLabel(m_layout)->setText(
"<i>You can now browse your project while running a second pass for in-depth indexing!</i>"
);
m_layout->addSpacing(12);
}
{
QHBoxLayout* buttons = new QHBoxLayout();
if (interrupted)
@@ -49,10 +63,17 @@ QtIndexingReportDialog::QtIndexingReportDialog(
connect(discardButton, &QPushButton::clicked, this, &QtIndexingReportDialog::onDiscardPressed);
buttons->addWidget(discardButton);
}
else if (shallow)
{
QPushButton* startInDepthButton = new QPushButton("Start In-Depth Indexing");
startInDepthButton->setObjectName("windowButton");
connect(startInDepthButton, &QPushButton::clicked, this, &QtIndexingReportDialog::onStartInDepthPressed);
buttons->addWidget(startInDepthButton);
}
buttons->addStretch();
QPushButton* confirmButton = new QPushButton(interrupted ? "Keep" : "OK");
QPushButton* confirmButton = new QPushButton(interrupted ? "Keep" : (shallow ? "Quit" : "OK"));
confirmButton->setObjectName("windowButton");
confirmButton->setDefault(true);
connect(confirmButton, &QPushButton::clicked, this, &QtIndexingReportDialog::onConfirmPressed);
@@ -128,3 +149,8 @@ void QtIndexingReportDialog::onDiscardPressed()
{
emit QtIndexingDialog::canceled();
}
void QtIndexingReportDialog::onStartInDepthPressed()
{
emit requestReindexing();
}
@@ -8,8 +8,11 @@ class QtIndexingReportDialog
{
Q_OBJECT
signals :
void requestReindexing();
public:
QtIndexingReportDialog(size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, float time, bool interrupted, QWidget* parent = 0);
QtIndexingReportDialog(size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, float time, bool interrupted, bool shallow, QWidget* parent = 0);
QSize sizeHint() const override;
void updateErrorCount(size_t errorCount, size_t fatalCount);
@@ -21,6 +24,7 @@ protected:
private:
void onConfirmPressed();
void onDiscardPressed();
void onStartInDepthPressed();
QWidget* m_errorWidget;
bool m_interrupted;
@@ -1,12 +1,13 @@
#include "QtIndexingStartDialog.h"
#include <QCheckBox>
#include <QLabel>
#include <QRadioButton>
#include <QPushButton>
#include <QRadioButton>
#include "QtHelpButton.h"
QtIndexingStartDialog::QtIndexingStartDialog(const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode, QWidget* parent)
QtIndexingStartDialog::QtIndexingStartDialog(const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode, bool enabledShallowOption, bool initialShallowState, QWidget* parent)
: QtIndexingDialog(true, parent)
{
setSizeGripStyle(false);
@@ -37,11 +38,18 @@ QtIndexingStartDialog::QtIndexingStartDialog(const std::vector<RefreshMode>& ena
QtHelpButton* helpButton = new QtHelpButton(
"Indexing Modes",
"<b>Updated files:</b> Reindexes all files that were modified since the last indexing, all files depending "
"on those and new files.<br /><br />"
"<b>Incomplete & updated files:</b> Reindexes all files that had errors during last indexing, all files "
"depending on those and all updated files.<br /><br />"
"<b>All files:</b> Deletes the previous index and reindexes all files.<br /><br />"
QString("<b>Updated files:</b> Reindexes all files that were modified since the last indexing, all new files and all files depending "
"on those.<br /><br />"
"<b>Incomplete & updated files:</b> Reindexes all files that had errors during last indexing, all updated files and all files "
"depending on those.<br /><br />"
"<b>All files:</b> Deletes the previous index and reindexes all files from scratch.<br /><br />") +
(enabledShallowOption ?
"<br /><b>Shallow Python Indexing:</b> References within your code base (calls, usages, etc.) are resolved by name, which is "
"imprecise but much faster than in-depth indexing.<br />"
"<i>Hint: Use this option for a quick first indexing pass and start browsing the code base "
"while running a second pass for in-depth indexing.<br /><br />" :
""
)
);
helpButton->setColor(Qt::white);
modeTitleLayout->addWidget(helpButton);
@@ -91,6 +99,14 @@ QtIndexingStartDialog::QtIndexingStartDialog(const std::vector<RefreshMode>& ena
m_refreshModeButtons[mode]->setEnabled(true);
}
if (enabledShallowOption)
{
QCheckBox* shallowIndexingCheckBox = new QCheckBox("Shallow Python Indexing");
connect(shallowIndexingCheckBox, &QCheckBox::toggled, [=]() { emit setShallowIndexing(shallowIndexingCheckBox->isChecked()); });
shallowIndexingCheckBox->setChecked(initialShallowState);
modeLayout->addWidget(shallowIndexingCheckBox);
}
subLayout->addLayout(modeLayout);
m_layout->addLayout(subLayout);
@@ -14,10 +14,11 @@ class QtIndexingStartDialog
signals:
void setMode(RefreshMode mode);
void setShallowIndexing(bool enabled);
void startIndexing(RefreshMode mode);
public:
QtIndexingStartDialog(const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode, QWidget* parent = 0);
QtIndexingStartDialog(const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode, bool enabledShallowOption, bool initialShallowState, QWidget* parent = 0);
QSize sizeHint() const override;
void updateRefreshInfo(const RefreshInfo& info);
+3 -2
View File
@@ -3,6 +3,7 @@
#include "IndexerCommandJava.h"
#include "FileManager.h"
#include "logging.h"
#include "RefreshInfo.h"
#include "SourceGroupSettings.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithJavaStandard.h"
@@ -33,7 +34,7 @@ std::set<FilePath> SourceGroupJava::getAllSourceFilePaths() const
return fileManager.getAllSourceFilePaths();
}
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands(const RefreshInfo& info) const
{
const std::wstring languageStandard =
dynamic_cast<const SourceGroupSettingsWithJavaStandard*>(getSourceGroupSettings().get())->getJavaStandard();
@@ -43,7 +44,7 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
for (const FilePath& sourcePath: getAllSourceFilePaths())
{
if (filesToIndex.find(sourcePath) != filesToIndex.end())
if (info.filesToIndex.find(sourcePath) != info.filesToIndex.end())
{
indexerCommands.push_back(std::make_shared<IndexerCommandJava>(
sourcePath, languageStandard, classPath
+1 -1
View File
@@ -13,7 +13,7 @@ class SourceGroupJava
public:
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
std::set<FilePath> getAllSourceFilePaths() const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const RefreshInfo& info) const override;
private:
virtual std::vector<FilePath> getAllSourcePaths() const = 0;
@@ -1,12 +1,13 @@
#include "SourceGroupJavaSonargraph.h"
#include "IndexerCommandJava.h"
#include "ApplicationSettings.h"
#include "SourceGroupSettingsJavaSonargraph.h"
#include "MessageStatus.h"
#include "SonargraphProject.h"
#include "utilityJava.h"
#include "Application.h"
#include "ApplicationSettings.h"
#include "IndexerCommandJava.h"
#include "MessageStatus.h"
#include "RefreshInfo.h"
#include "SonargraphProject.h"
#include "SourceGroupSettingsJavaSonargraph.h"
#include "utilityJava.h"
SourceGroupJavaSonargraph::SourceGroupJavaSonargraph(std::shared_ptr<SourceGroupSettingsJavaSonargraph> settings)
: m_settings(settings)
@@ -65,7 +66,7 @@ std::set<FilePath> SourceGroupJavaSonargraph::getAllSourceFilePaths() const
return std::set<FilePath>();
}
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJavaSonargraph::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJavaSonargraph::getIndexerCommands(const RefreshInfo& info) const
{
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
@@ -75,7 +76,7 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJavaSonargraph::getIndex
{
for (std::shared_ptr<IndexerCommand> indexerCommand : project->getIndexerCommands(m_settings, ApplicationSettings::getInstance()))
{
if (filesToIndex.find(indexerCommand->getSourceFilePath()) != filesToIndex.end())
if (info.filesToIndex.find(indexerCommand->getSourceFilePath()) != info.filesToIndex.end())
{
indexerCommands.push_back(indexerCommand);
}
@@ -17,7 +17,7 @@ public:
bool prepareIndexing() override;
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
std::set<FilePath> getAllSourceFilePaths() const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const RefreshInfo& info) const override;
private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
@@ -4,6 +4,7 @@
#include "FileManager.h"
#include "IndexerCommandCustom.h"
#include "ProjectSettings.h"
#include "RefreshInfo.h"
#include "ResourcePaths.h"
#include "SourceGroupSettingsPythonEmpty.h"
#include "SqliteIndexStorage.h"
@@ -19,6 +20,12 @@ bool SourceGroupPythonEmpty::allowsPartialClearing() const
return false;
}
bool SourceGroupPythonEmpty::allowsShallowIndexing() const
{
return true;
}
std::set<FilePath> SourceGroupPythonEmpty::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
{
return SourceGroup::filterToContainedFilePaths(
@@ -40,7 +47,7 @@ std::set<FilePath> SourceGroupPythonEmpty::getAllSourceFilePaths() const
return fileManager.getAllSourceFilePaths();
}
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupPythonEmpty::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupPythonEmpty::getIndexerCommands(const RefreshInfo& info) const
{
std::wstring args = L"";
@@ -57,10 +64,15 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupPythonEmpty::getIndexerC
args += L" --verbose";
}
if (info.shallow)
{
args += L" --shallow";
}
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
for (const FilePath& sourceFilePath : getAllSourceFilePaths())
{
if (filesToIndex.find(sourceFilePath) != filesToIndex.end())
if (info.filesToIndex.find(sourceFilePath) != info.filesToIndex.end())
{
indexerCommands.push_back(std::make_shared<IndexerCommandCustom>(
INDEXER_COMMAND_PYTHON,
@@ -14,9 +14,10 @@ public:
SourceGroupPythonEmpty(std::shared_ptr<SourceGroupSettingsPythonEmpty> settings);
bool allowsPartialClearing() const override;
bool allowsShallowIndexing() const override;
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
std::set<FilePath> getAllSourceFilePaths() const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override;
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const RefreshInfo& info) const override;
private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
+1 -1
View File
@@ -80,7 +80,7 @@ namespace
return m_sourceFilePaths;
}
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const RefreshInfo& info) const override
{
return std::vector<std::shared_ptr<IndexerCommand>>();
}
+3 -1
View File
@@ -157,7 +157,9 @@ namespace
{
const FilePath projectDataRoot = getInputDirectoryPath(projectName).makeAbsolute();
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands = sourceGroup->getIndexerCommands(sourceGroup->getAllSourceFilePaths());
RefreshInfo info;
info.filesToIndex = sourceGroup->getAllSourceFilePaths();
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands = sourceGroup->getIndexerCommands(info);
std::sort(
indexerCommands.begin(),