MCPcopy Create free account
hub / github.com/KDE/kdevelop / updateFiles

Method updateFiles

kdevplatform/language/codegen/documentchangeset.cpp:559–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

557}
558
559void DocumentChangeSetPrivate::updateFiles()
560{
561 ModificationRevisionSet::clearCache();
562 const auto files = changes.keys();
563 for (const IndexedString& file : files) {
564 ModificationRevision::clearModificationCache(file);
565 }
566
567 if (updatePolicy != DocumentChangeSet::NoUpdate && ICore::self()) {
568 // The active document should be updated first, so that the user sees the results instantly
569 if (IDocument* activeDoc = ICore::self()->documentController()->activeDocument()) {
570 ICore::self()->languageController()->backgroundParser()->addDocument(IndexedString(activeDoc->url()));
571 }
572
573 // If there are currently open documents that now need an update, update them too
574 const auto documents = ICore::self()->languageController()->backgroundParser()->managedDocuments();
575 for (const IndexedString& doc : documents) {
576 DUChainReadLocker lock(DUChain::lock());
577 TopDUContext* top = DUChainUtils::standardContextForUrl(doc.toUrl(), true);
578 if ((top && top->parsingEnvironmentFile() && top->parsingEnvironmentFile()->needsUpdate()) || !top) {
579 lock.unlock();
580 ICore::self()->languageController()->backgroundParser()->addDocument(doc);
581 }
582 }
583
584 // Eventually update _all_ affected files
585 const auto files = changes.keys();
586 for (const IndexedString& file : files) {
587 if (!file.toUrl().isValid()) {
588 qCWarning(LANGUAGE) << "Trying to apply changes to an invalid document";
589 continue;
590 }
591
592 ICore::self()->languageController()->backgroundParser()->addDocument(file);
593 }
594 }
595}
596}

Callers 1

applyAllChangesMethod · 0.80

Calls 14

activeDocumentMethod · 0.80
documentControllerMethod · 0.80
backgroundParserMethod · 0.80
languageControllerMethod · 0.80
managedDocumentsMethod · 0.80
IndexedStringClass · 0.70
keysMethod · 0.45
addDocumentMethod · 0.45
urlMethod · 0.45
toUrlMethod · 0.45
needsUpdateMethod · 0.45

Tested by

no test coverage detected