Fixed QTCREATORBUG-1397.

When adding a new file, refreshing semantic errors in the open editor should
have worked. It now also works for removing existing files.

Done-with: Christian Kamm
This commit is contained in:
Erik Verbruggen
2010-05-18 13:40:35 +02:00
parent 62141475e3
commit ef66bc98e2
13 changed files with 45 additions and 32 deletions

View File

@@ -254,9 +254,7 @@ void Snapshot::insert(const Document::Ptr &document)
const QString fileName = document->fileName();
const QString path = document->path();
Document::Ptr old = _documents.value(fileName);
if (old)
_documentsByPath.remove(path, old);
remove(fileName);
_documentsByPath.insert(path, document);
_documents.insert(fileName, document);
}
@@ -267,6 +265,15 @@ void Snapshot::insertLibraryInfo(const QString &path, const LibraryInfo &info)
_libraries.insert(QDir::cleanPath(path), info);
}
void Snapshot::remove(const QString &fileName)
{
Document::Ptr doc = _documents.value(fileName);
if (!doc.isNull()) {
_documentsByPath.remove(doc->path(), doc);
_documents.remove(fileName);
}
}
Document::Ptr Snapshot::documentFromSource(const QString &code,
const QString &fileName) const
{