forked from qt-creator/qt-creator
QmakeProjectManager: Restore incremental re-parsing
This was broken in commit 37aecdd112, where we overlooked that a special
type of IDocument was used that triggers a re-parse of only the affected
part of the project tree. As a result, all changes to a .pri or .pro file
would trigger a re-parse of the entire project.
Fixes: QTCREATORBUG-24572
Change-Id: I480cff4e53cf86a17e1eaac0eb9b32901bc87051
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -64,7 +64,6 @@
|
||||
#include <QFileDialog>
|
||||
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
|
||||
/*!
|
||||
\class ProjectExplorer::Project
|
||||
@@ -357,7 +356,8 @@ void Project::setNeedsInitialExpansion(bool needsExpansion)
|
||||
d->m_needsInitialExpansion = needsExpansion;
|
||||
}
|
||||
|
||||
void Project::setExtraProjectFiles(const QSet<Utils::FilePath> &projectDocumentPaths)
|
||||
void Project::setExtraProjectFiles(const QSet<Utils::FilePath> &projectDocumentPaths,
|
||||
const DocGenerator docGenerator)
|
||||
{
|
||||
QSet<Utils::FilePath> uniqueNewFiles = projectDocumentPaths;
|
||||
uniqueNewFiles.remove(projectFilePath()); // Make sure to never add the main project file!
|
||||
@@ -372,8 +372,14 @@ void Project::setExtraProjectFiles(const QSet<Utils::FilePath> &projectDocumentP
|
||||
return toRemove.contains(d->filePath());
|
||||
});
|
||||
for (const Utils::FilePath &p : toAdd) {
|
||||
d->m_extraProjectDocuments.emplace_back(
|
||||
std::make_unique<ProjectDocument>(d->m_document->mimeType(), p, this));
|
||||
if (docGenerator) {
|
||||
std::unique_ptr<Core::IDocument> doc = docGenerator(p);
|
||||
QTC_ASSERT(doc, continue);
|
||||
d->m_extraProjectDocuments.push_back(std::move(doc));
|
||||
} else {
|
||||
d->m_extraProjectDocuments.emplace_back(std::make_unique<ProjectDocument>(
|
||||
d->m_document->mimeType(), p, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -802,6 +808,19 @@ bool Project::isKnownFile(const Utils::FilePath &filename) const
|
||||
&element, nodeLessThan);
|
||||
}
|
||||
|
||||
const Node *Project::nodeForFilePath(const Utils::FilePath &filePath,
|
||||
const Project::NodeMatcher &extraMatcher)
|
||||
{
|
||||
const FileNode dummy(filePath, FileType::Unknown);
|
||||
const auto range = std::equal_range(d->m_sortedNodeList.cbegin(), d->m_sortedNodeList.cend(),
|
||||
&dummy, &nodeLessThan);
|
||||
for (auto it = range.first; it != range.second; ++it) {
|
||||
if ((*it)->filePath() == filePath && (!extraMatcher || extraMatcher(*it)))
|
||||
return *it;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Project::setProjectLanguages(Core::Context language)
|
||||
{
|
||||
if (d->m_projectLanguages == language)
|
||||
|
||||
Reference in New Issue
Block a user