| 1583 | } |
| 1584 | |
| 1585 | void 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 | |
| 1613 | void DUChain::documentClosed(IDocument* document) |
| 1614 | { |
nothing calls this directly
no test coverage detected