logic: Added indexing mode to reindex incomplete files (issue #493, #496)

* added radio buttons to start indexing dialog
* don't block task scheduler thread while start indexing dialog is visible
* don't force whole project refresh on settings change
* added help button to start indexing dialog explaining indexing modes
* disable unavailable modes when project needs full refresh
* improved label texts on indexing dialogs
* added --incomplete flag to index command of commandline API
* fixed deletion of window stack elements
This commit is contained in:
Eberhard Graether
2017-12-03 22:30:09 +01:00
parent faf9e7655f
commit f9e4afda77
33 changed files with 748 additions and 529 deletions
+13 -8
View File
@@ -23,7 +23,7 @@ SourceGroupType SourceGroupCxxCdb::getType() const
return SOURCE_GROUP_CXX_CDB;
}
bool SourceGroupCxxCdb::prepareRefresh()
bool SourceGroupCxxCdb::prepareIndexing()
{
FilePath cdbPath = m_settings->getCompilationDatabasePathExpandedAndAbsolute();
if (!cdbPath.empty() && !cdbPath.exists())
@@ -47,8 +47,7 @@ bool SourceGroupCxxCdb::prepareRefresh()
return true;
}
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxCdb::getIndexerCommands(
const std::set<FilePath>& filesToIndex, bool fullRefresh)
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxCdb::getIndexerCommands(const std::set<FilePath>& filesToIndex)
{
std::shared_ptr<ApplicationSettings> appSettings = ApplicationSettings::getInstance();
@@ -75,16 +74,20 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxCdb::getIndexerComman
std::set<FilePath> indexedPaths = getIndexedPaths();
std::set<FilePath> excludedPaths = getExcludedPaths();
const std::set<FilePath>& sourceFilePathsToIndex = (fullRefresh ? getAllSourceFilePaths() : getSourceFilePathsToIndex());
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
FilePath cdbPath = m_settings->getCompilationDatabasePathExpandedAndAbsolute();
if (cdbPath.exists())
{
std::string error;
std::shared_ptr<clang::tooling::JSONCompilationDatabase> cdb = std::shared_ptr<clang::tooling::JSONCompilationDatabase>
(clang::tooling::JSONCompilationDatabase::loadFromFile(cdbPath.str(), error, clang::tooling::JSONCommandLineSyntax::AutoDetect));
std::shared_ptr<clang::tooling::JSONCompilationDatabase> cdb =
std::shared_ptr<clang::tooling::JSONCompilationDatabase>(
clang::tooling::JSONCompilationDatabase::loadFromFile(cdbPath.str(),
error,
clang::tooling::JSONCommandLineSyntax::AutoDetect
)
);
if (!error.empty())
{
const std::string message = "Loading Clang compilation database failed with error: \"" + error + "\"";
@@ -92,6 +95,8 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxCdb::getIndexerComman
MessageStatus(message, true).dispatch();
}
const std::set<FilePath>& sourceFilePaths = getAllSourceFilePaths();
for (const clang::tooling::CompileCommand& command: cdb->getAllCompileCommands())
{
FilePath sourcePath = FilePath(command.Filename).canonical();
@@ -101,7 +106,7 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxCdb::getIndexerComman
}
if (filesToIndex.find(sourcePath) != filesToIndex.end() &&
sourceFilePathsToIndex.find(sourcePath) != sourceFilePathsToIndex.end())
sourceFilePaths.find(sourcePath) != sourceFilePaths.end())
{
std::vector<std::string> currentCompilerFlags = compilerFlags;
currentCompilerFlags.insert(currentCompilerFlags.end(), command.CommandLine.begin(), command.CommandLine.end());
+2 -3
View File
@@ -15,10 +15,9 @@ public:
virtual SourceGroupType getType() const;
virtual bool prepareRefresh();
virtual bool prepareIndexing();
virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(
const std::set<FilePath>& filesToIndex, bool fullRefresh);
virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex);
private:
virtual std::shared_ptr<SourceGroupSettingsCxx> getSourceGroupSettingsCxx();
+2 -5
View File
@@ -18,8 +18,7 @@ SourceGroupType SourceGroupCxxEmpty::getType() const
return m_settings->getType(); // may be either C or Cpp
}
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxEmpty::getIndexerCommands(
const std::set<FilePath>& filesToIndex, bool fullRefresh)
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxEmpty::getIndexerCommands(const std::set<FilePath>& filesToIndex)
{
std::shared_ptr<ApplicationSettings> appSettings = ApplicationSettings::getInstance();
@@ -54,10 +53,8 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxEmpty::getIndexerComm
std::set<FilePath> indexedPaths = getIndexedPaths();
std::set<FilePath> excludedPaths = getExcludedPaths();
const std::set<FilePath>& sourceFilePathsToIndex = (fullRefresh ? getAllSourceFilePaths() : getSourceFilePathsToIndex());
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
for (const FilePath& sourcePath: sourceFilePathsToIndex)
for (const FilePath& sourcePath: getAllSourceFilePaths())
{
if (filesToIndex.find(sourcePath) != filesToIndex.end())
{
+1 -2
View File
@@ -15,8 +15,7 @@ public:
virtual SourceGroupType getType() const;
virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(
const std::set<FilePath>& filesToIndex, bool fullRefresh);
virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex);
private:
virtual std::shared_ptr<SourceGroupSettingsCxx> getSourceGroupSettingsCxx();