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

Method loadAsyncFromFile

src/eepp/ui/uicodeeditor.cpp:526–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

524}
525
526bool UICodeEditor::loadAsyncFromFile(
527 const std::string& path, std::shared_ptr<ThreadPool> pool,
528 std::function<void( std::shared_ptr<TextDocument>, bool )> onLoaded ) {
529 bool wasLocked = isLocked();
530 if ( !wasLocked )
531 setLocked( true );
532 bool ret = mDoc->loadAsyncFromFile(
533 path, pool, [this, onLoaded, wasLocked]( TextDocument*, bool success ) {
534 if ( !success ) {
535 runOnMainThread( [this, onLoaded, wasLocked, success] {
536 if ( !wasLocked )
537 setLocked( false );
538 if ( onLoaded )
539 onLoaded( mDoc, success );
540 } );
541 return;
542 }
543 if ( mMinimapEnabled && getUISceneNode()->hasThreadPool() ) {
544 mDoc->getHighlighter()->tokenizeAsync( getUISceneNode()->getThreadPool(), [this] {
545 runOnMainThread( [this] { invalidateDraw(); } );
546 } );
547 }
548
549 if ( mDocView.isWrapEnabled() )
550 mDocView.setPendingReconstruction( true );
551
552 runOnMainThread( [this, onLoaded, wasLocked, success] {
553 if ( !wasLocked )
554 setLocked( false );
555 onDocumentLoaded();
556 if ( onLoaded )
557 onLoaded( mDoc, success );
558 } );
559 } );
560 if ( !ret && !wasLocked )
561 setLocked( false );
562 return ret;
563}
564
565TextDocument::LoadStatus UICodeEditor::loadFromURL( const std::string& url,
566 const Http::Request::FieldTable& headers ) {

Callers

nothing calls this directly

Calls 6

hasThreadPoolMethod · 0.80
tokenizeAsyncMethod · 0.80
getHighlighterMethod · 0.80
isWrapEnabledMethod · 0.80
getThreadPoolMethod · 0.45

Tested by

no test coverage detected