MCPcopy Create free account
hub / github.com/SpartanJ/eepp / updateDocCache

Method updateDocCache

src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp:601–647  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599}
600
601void AutoCompletePlugin::updateDocCache( TextDocument* doc ) {
602 ScopedOp op(
603 [this, doc] {
604 Lock lu( mDocsUpdatingMutex );
605 mDocsUpdating[doc] = true;
606 },
607 [this, doc] {
608 Lock lu( mDocsUpdatingMutex );
609 mDocsUpdating[doc] = false;
610 } );
611
612 Clock clock;
613 std::unordered_map<TextDocument*, DocCache>::iterator docCache;
614 {
615 Lock l( mDocMutex );
616 docCache = mDocCache.find( doc );
617 if ( docCache == mDocCache.end() || mShuttingDown )
618 return;
619 }
620
621 auto changeId = doc->getCurrentChangeId();
622 auto symbols = getDocumentSymbols( doc );
623
624 {
625 Lock l( mDocMutex );
626 docCache = mDocCache.find( doc );
627 if ( docCache == mDocCache.end() || mShuttingDown )
628 return;
629 auto& cache = docCache->second;
630 cache.changeId = changeId;
631 cache.symbols = std::move( symbols );
632 }
633
634 std::string langName( doc->getSyntaxDefinition().getLanguageName() );
635 {
636 Lock l( mLangSymbolsMutex );
637 auto& lang = mLangCache[langName];
638 lang.clear();
639 Lock l2( mDocMutex );
640 for ( const auto& d : mDocCache ) {
641 if ( d.first->getSyntaxDefinition().getLanguageName() == langName )
642 lang.insert( lang.end(), d.second.symbols.begin(), d.second.symbols.end() );
643 }
644 }
645 Log::debug( "Dictionary for %s updated in: %.2fms", doc->getFilename(),
646 clock.getElapsedTime().asMilliseconds() );
647}
648
649void AutoCompletePlugin::updateLangCache( const std::string& langName ) {
650 Clock clock;

Callers

nothing calls this directly

Calls 10

debugFunction · 0.85
getFilenameMethod · 0.80
asMillisecondsMethod · 0.80
getElapsedTimeMethod · 0.80
findMethod · 0.45
endMethod · 0.45
getCurrentChangeIdMethod · 0.45
clearMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected