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

Method documentActivated

kdevplatform/language/duchain/duchain.cpp:1585–1611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1583}
1584
1585void DUChain::documentActivated(KDevelop::IDocument* doc)
1586{
1587 if (sdDUChainPrivate->m_destroyed)
1588 return;
1589
1590 DUChainReadLocker lock(DUChain::lock());
1591 QMutexLocker l(&sdDUChainPrivate->m_chainsMutex);
1592
1593 auto backgroundParser = ICore::self()->languageController()->backgroundParser();
1594 auto addWithHighPriority = [backgroundParser, doc]() {
1595 backgroundParser->addDocument(IndexedString(doc->url()),
1596 TopDUContext::VisibleDeclarationsAndContexts,
1597 BackgroundParser::BestPriority);
1598 };
1599
1600 TopDUContext* ctx = DUChainUtils::standardContextForUrl(doc->url(), true);
1601 //Check whether the document has an attached environment-manager, and whether that one thinks the document needs to be updated.
1602 //If yes, update it.
1603 if (ctx && ctx->parsingEnvironmentFile() && ctx->parsingEnvironmentFile()->needsUpdate()) {
1604 qCDebug(LANGUAGE) << "Document needs update, using best priority since it just got activated:" << doc->url();
1605 addWithHighPriority();
1606 } else if (backgroundParser->managedDocuments().contains(IndexedString(doc->url()))) {
1607 // increase priority if there's already parse job of this document in the queue
1608 qCDebug(LANGUAGE) << "Prioritizing activated document:" << doc->url();
1609 addWithHighPriority();
1610 }
1611}
1612
1613void DUChain::documentClosed(IDocument* document)
1614{

Callers

nothing calls this directly

Calls 9

backgroundParserMethod · 0.80
languageControllerMethod · 0.80
managedDocumentsMethod · 0.80
IndexedStringClass · 0.70
addDocumentMethod · 0.45
urlMethod · 0.45
needsUpdateMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected