diff --git a/include/eepp/ui/abstract/uiabstractview.hpp b/include/eepp/ui/abstract/uiabstractview.hpp index cb2074760..274834f9d 100644 --- a/include/eepp/ui/abstract/uiabstractview.hpp +++ b/include/eepp/ui/abstract/uiabstractview.hpp @@ -105,8 +105,12 @@ class EE_API UIAbstractView : public UIScrollableWidget { std::function onCreateEditingDelegate; SelectionType getSelectionType() const; + void setSelectionType( SelectionType selectionType ); + Uint32 onModelEvent( const std::function& callback, + const Event::EventType& triggerEventType = Event::EventType::NoEvent ); + protected: friend class EE::UI::Models::Model; diff --git a/src/eepp/ui/abstract/uiabstractview.cpp b/src/eepp/ui/abstract/uiabstractview.cpp index 45a85e634..72e99c3fd 100644 --- a/src/eepp/ui/abstract/uiabstractview.cpp +++ b/src/eepp/ui/abstract/uiabstractview.cpp @@ -25,6 +25,19 @@ void UIAbstractView::setSelectionType( SelectionType selectionType ) { } } +Uint32 UIAbstractView::onModelEvent( const std::function& callback, + const Event::EventType& triggerEventType ) { + return addEventListener( + Event::OnModelEvent, [callback, triggerEventType]( const Event* event ) { + auto modelEvent = static_cast( event ); + if ( modelEvent->getModel() && modelEvent->getModelIndex().isValid() && + ( triggerEventType == Event::EventType::NoEvent || + modelEvent->getTriggerEvent()->getType() == triggerEventType ) ) { + callback( modelEvent ); + } + } ); +} + KeyBindings::Shortcut UIAbstractView::getEditShortcut() const { return mEditShortcut; } diff --git a/src/eepp/ui/doc/syntaxdefinitionmanager.cpp b/src/eepp/ui/doc/syntaxdefinitionmanager.cpp index 34acac700..3699a3b9b 100644 --- a/src/eepp/ui/doc/syntaxdefinitionmanager.cpp +++ b/src/eepp/ui/doc/syntaxdefinitionmanager.cpp @@ -1505,7 +1505,7 @@ static void addRust() { { { "\"", "\"", "\\" }, "string" }, { { "`", "`", "\\" }, "string" }, { { "'.'" }, "string" }, - { { "'%a+" }, "keyword2" }, + { { "[%a_][%a%d_]*" }, "keyword2" }, { { "0[oO_][0-7]+" }, "number" }, { { "-?0x[%x_]+" }, "number" }, { { "-?%d+_%d" }, "number" }, diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index 41e6a85b2..15e88c1cd 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -1822,6 +1822,11 @@ std::map App::getLocalKeybindings() { { { KEY_2, KEYMOD_LALT }, "toggle-status-global-search-bar" }, { { KEY_3, KEYMOD_LALT }, "toggle-status-terminal" }, { { KEY_4, KEYMOD_LALT }, "toggle-status-build-output" }, + { { KEY_B, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "project-build-start" }, + { { KEY_C, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "project-build-cancel" }, + { { KEY_O, KEYMOD_LALT | KEYMOD_SHIFT }, "show-open-documents" }, + { { KEY_K, KEYMOD_CTRL | KEYMOD_SHIFT }, "open-workspace-symbol-search" }, + { { KEY_P, KEYMOD_CTRL | KEYMOD_SHIFT }, "open-document-symbol-search" }, }; } @@ -1889,7 +1894,10 @@ std::vector App::getUnlockedCommands() { "monospace-font", "terminal-font", "fallback-font", - "tree-view-configure-ignore-files" }; + "tree-view-configure-ignore-files", + "show-open-documents", + "open-workspace-symbol-search", + "open-document-symbol-search" }; } bool App::isUnlockedCommand( const std::string& command ) { diff --git a/src/tools/ecode/ecode.hpp b/src/tools/ecode/ecode.hpp index ce668b300..bf0239f60 100644 --- a/src/tools/ecode/ecode.hpp +++ b/src/tools/ecode/ecode.hpp @@ -236,6 +236,7 @@ class App : public UICodeEditorSplitter::Client { t.setCommand( "open-locatebar", [&] { mUniversalLocator->showLocateBar(); } ); t.setCommand( "toggle-status-locate-bar", [&] { mUniversalLocator->toggleLocateBar(); } ); t.setCommand( "open-command-palette", [&] { mUniversalLocator->showCommandPalette(); } ); + t.setCommand( "show-open-documents", [&] { mUniversalLocator->showOpenDocuments(); } ); t.setCommand( "project-build-start", [&] { if ( mProjectBuildManager && mStatusBuildOutputController ) { if ( mProjectBuildManager->isBuilding() ) { diff --git a/src/tools/ecode/projectbuild.cpp b/src/tools/ecode/projectbuild.cpp index c13fc7870..7763efdf4 100644 --- a/src/tools/ecode/projectbuild.cpp +++ b/src/tools/ecode/projectbuild.cpp @@ -207,9 +207,9 @@ void ProjectBuildManager::addBuild( UIWidget* buildTab ) { widget->asType()->select(); return; } - auto ret = - mApp->getSplitter()->createWidget( UIBuildSettings::New( mNewBuild, mConfig, true ), - mApp->i18n( "build_settings", "Build Settings" ) ); + auto ret = mApp->getSplitter()->createWidget( + UIBuildSettings::New( mNewBuild, mConfig, true, nullptr ), + mApp->i18n( "build_settings", "Build Settings" ) ); auto bs = ret.second->asType(); bs->setTab( ret.first ); mCbs[bs].insert( bs->on( Event::OnConfirm, [this, bs]( const Event* event ) { @@ -245,9 +245,17 @@ void ProjectBuildManager::editBuild( std::string buildName, UIWidget* buildTab ) widget->asType()->select(); return; } - auto ret = - mApp->getSplitter()->createWidget( UIBuildSettings::New( build->second, mConfig, false ), - mApp->i18n( "build_settings", "Build Settings" ) ); + auto ret = mApp->getSplitter()->createWidget( + UIBuildSettings::New( build->second, mConfig, false, + [this]( const std::string& oldName, const std::string& newName ) { + auto buildIt = mBuilds.find( oldName ); + if ( buildIt != mBuilds.end() ) { + auto build = mBuilds.extract( buildIt ); + build.key() = newName; + mBuilds.insert( std::move( build ) ); + } + } ), + mApp->i18n( "build_settings", "Build Settings" ) ); auto bs = ret.second->asType(); bs->setTab( ret.first ); mCbs[bs].insert( bs->on( Event::OnConfirm, [this, bs]( const Event* event ) { @@ -328,6 +336,8 @@ ProjectBuildCommandsRes ProjectBuildManager::generateBuildCommands( const std::s ProjectBuildCommand buildCmd( step ); replaceVar( buildCmd, VAR_OS, currentOS ); replaceVar( buildCmd, VAR_NPROC, nproc ); + if ( buildCmd.workingDir.empty() ) + buildCmd.workingDir = mProjectRoot; if ( !buildType.empty() ) replaceVar( buildCmd, VAR_BUILD_TYPE, buildType ); buildCmd.config = build.mConfig; diff --git a/src/tools/ecode/settingsmenu.cpp b/src/tools/ecode/settingsmenu.cpp index 6d90944be..35f9d9984 100644 --- a/src/tools/ecode/settingsmenu.cpp +++ b/src/tools/ecode/settingsmenu.cpp @@ -1269,6 +1269,10 @@ UIPopUpMenu* SettingsMenu::createToolsMenu() { ->add( i18n( "project_find", "Project Find..." ), findIcon( "search" ), getKeybind( "open-global-search" ) ) ->setId( "open-global-search" ); + mToolsMenu + ->add( i18n( "show_open_documents", "Show Open Documents..." ), findIcon( "search" ), + getKeybind( "show-open-documents" ) ) + ->setId( "show-open-documents" ); mToolsMenu ->add( i18n( "workspace_symbol_find", "Search Worskspace Symbol..." ), findIcon( "search" ), getKeybind( "open-workspace-symbol-search" ) ) diff --git a/src/tools/ecode/statusbuildoutputcontroller.cpp b/src/tools/ecode/statusbuildoutputcontroller.cpp index 7b7ece4e9..883458844 100644 --- a/src/tools/ecode/statusbuildoutputcontroller.cpp +++ b/src/tools/ecode/statusbuildoutputcontroller.cpp @@ -116,9 +116,15 @@ bool StatusBuildOutputController::searchFindAndAddStatusResult( status.message = subtxt.substr( 0, nl ); } } else if ( pattern.config.patternOrder.file == i ) { - status.file = !subtxt.empty() && subtxt[0] == '.' + bool isRelativePath = FileSystem::isRelativePath( subtxt ); + status.file = !subtxt.empty() && isRelativePath ? FileSystem::getRealPath( cmd->workingDir + subtxt ) : FileSystem::getRealPath( subtxt ); + if ( isRelativePath ) { + FileInfo file( status.file ); + if ( !file.exists() || !file.isRegularFile() ) + status.file = subtxt; + } status.fileName = FileSystem::fileNameFromPath( status.file ); } else if ( pattern.config.patternOrder.line == i ) { int l; @@ -488,72 +494,90 @@ void StatusBuildOutputController::createContainer() { mTableIssues->setModel( StatusMessageModel::create( mStatusResults, mApp->getUISceneNode() ) ); setHeaderWidth(); mTableIssues->on( Event::OnSizeChange, [this]( auto ) { setHeaderWidth(); } ); - mTableIssues->on( Event::OnModelEvent, [this]( const Event* event ) { - auto modelEvent = static_cast( event ); + mTableIssues->onModelEvent( [this]( const ModelEvent* modelEvent ) { + auto model = modelEvent->getModel(); auto idx = modelEvent->getModelIndex(); - if ( modelEvent->getModel() && idx.isValid() ) { - auto model = modelEvent->getModel(); - if ( modelEvent->getModelEventType() == ModelEventType::Open ) { - Variant vPath( model->data( idx, ModelRole::Custom ) ); - if ( vPath.isValid() && vPath.is( Variant::Type::cstr ) ) { - std::string path( vPath.asCStr() ); - UITab* tab = mSplitter->isDocumentOpen( path ); - Variant lineNum( model->data( - model->index( modelEvent->getModelIndex().row(), 1 ), ModelRole::Custom ) ); - Variant colNum( model->data( - model->index( modelEvent->getModelIndex().row(), 2 ), ModelRole::Custom ) ); - if ( !tab ) { - FileInfo fileInfo( path ); - if ( fileInfo.exists() && fileInfo.isRegularFile() ) - mApp->loadFileFromPath( - path, true, nullptr, - [&, lineNum, colNum]( UICodeEditor*, const std::string& ) { - onLoadDone( lineNum, colNum ); - } ); + if ( modelEvent->getModelEventType() == ModelEventType::Open ) { + Variant vPath( model->data( idx, ModelRole::Custom ) ); + if ( vPath.isValid() && vPath.is( Variant::Type::cstr ) ) { + std::string path( vPath.asCStr() ); + UITab* tab = mSplitter->isDocumentOpen( path ); + Variant lineNum( model->data( model->index( modelEvent->getModelIndex().row(), 1 ), + ModelRole::Custom ) ); + Variant colNum( model->data( model->index( modelEvent->getModelIndex().row(), 2 ), + ModelRole::Custom ) ); + if ( !tab ) { + FileInfo fileInfo( path ); + if ( fileInfo.exists() && fileInfo.isRegularFile() ) { + mApp->loadFileFromPath( + path, true, nullptr, + [&, lineNum, colNum]( UICodeEditor*, const std::string& ) { + onLoadDone( lineNum, colNum ); + } ); } else { - tab->getTabWidget()->setTabSelected( tab ); - onLoadDone( lineNum, colNum ); +#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN || defined( __EMSCRIPTEN_PTHREADS__ ) + mApp->getDirTree()->asyncFuzzyMatchTree( + path, 1, [this, colNum, lineNum]( std::shared_ptr res ) { + if ( res->rowCount( {} ) == 0 ) + return; + auto data = res->data( res->index( 0, 1 ) ); + if ( !data.isValid() ) + return; + std::string path = data.toString(); + UITab* tab = mSplitter->isDocumentOpen( path ); + if ( !tab ) { + mApp->loadFileFromPath( path, true, nullptr, + [&, lineNum, colNum]( auto, auto ) { + onLoadDone( lineNum, colNum ); + } ); + } else { + tab->getTabWidget()->setTabSelected( tab ); + onLoadDone( lineNum, colNum ); + } + } ); +#endif } - } - } else if ( modelEvent->getModelEventType() == ModelEventType::OpenMenu ) { - UIPopUpMenu* menu = UIPopUpMenu::New(); - menu->add( mApp->i18n( "copy_error_message", "Copy Error Message" ), - mApp->findIcon( "copy" ) ) - ->setId( "copy-error-message" ); - menu->add( mApp->i18n( "copy_file_path", "Copy File Path" ), - mApp->findIcon( "copy" ) ) - ->setId( "copy-file-path" ); - menu->on( - Event::OnItemClicked, [this, model, modelEvent, idx]( const Event* event ) { - UIMenuItem* item = event->getNode()->asType(); - std::string id( item->getId() ); - if ( id == "copy-error-message" ) { - Variant msg( - model->data( model->index( modelEvent->getModelIndex().row(), 0 ), - ModelRole::Display ) ); - mApp->getWindow()->getClipboard()->setText( msg.toString() ); - } else if ( id == "copy-file-path" ) { - Variant msg( model->data( idx, ModelRole::Custom ) ); - mApp->getWindow()->getClipboard()->setText( msg.toString() ); - } - } ); - UITableCell* cell = mTableIssues->getCellFromIndex( idx ); - if ( modelEvent->getTriggerEvent()->getType() == Event::MouseClick || - cell == nullptr ) { - Vector2f pos( mApp->getWindow()->getInput()->getMousePosf() ); - menu->nodeToWorldTranslation( pos ); - UIMenu::findBestMenuPos( pos, menu ); - menu->setPixelsPosition( pos ); } else { - Vector2f pos( 0, cell->getPixelsSize().getHeight() ); - cell->nodeToWorldTranslation( pos ); - UIMenu::findBestMenuPos( pos, menu ); - menu->setPixelsPosition( pos ); + tab->getTabWidget()->setTabSelected( tab ); + onLoadDone( lineNum, colNum ); } - menu->show(); } + } else if ( modelEvent->getModelEventType() == ModelEventType::OpenMenu ) { + UIPopUpMenu* menu = UIPopUpMenu::New(); + menu->add( mApp->i18n( "copy_error_message", "Copy Error Message" ), + mApp->findIcon( "copy" ) ) + ->setId( "copy-error-message" ); + menu->add( mApp->i18n( "copy_file_path", "Copy File Path" ), mApp->findIcon( "copy" ) ) + ->setId( "copy-file-path" ); + menu->on( Event::OnItemClicked, [this, model, modelEvent, idx]( const Event* event ) { + UIMenuItem* item = event->getNode()->asType(); + std::string id( item->getId() ); + if ( id == "copy-error-message" ) { + Variant msg( model->data( model->index( modelEvent->getModelIndex().row(), 0 ), + ModelRole::Display ) ); + mApp->getWindow()->getClipboard()->setText( msg.toString() ); + } else if ( id == "copy-file-path" ) { + Variant msg( model->data( idx, ModelRole::Custom ) ); + mApp->getWindow()->getClipboard()->setText( msg.toString() ); + } + } ); + UITableCell* cell = mTableIssues->getCellFromIndex( idx ); + if ( modelEvent->getTriggerEvent()->getType() == Event::MouseClick || + cell == nullptr ) { + Vector2f pos( mApp->getWindow()->getInput()->getMousePosf() ); + menu->nodeToWorldTranslation( pos ); + UIMenu::findBestMenuPos( pos, menu ); + menu->setPixelsPosition( pos ); + } else { + Vector2f pos( 0, cell->getPixelsSize().getHeight() ); + cell->nodeToWorldTranslation( pos ); + UIMenu::findBestMenuPos( pos, menu ); + menu->setPixelsPosition( pos ); + } + menu->show(); } } ); + mBuildOutput = editor; mContainer->setVisible( false ); mContainer->setCommand( "build-output-show-build-output", [this]() { showBuildOutput(); } ); diff --git a/src/tools/ecode/uibuildsettings.cpp b/src/tools/ecode/uibuildsettings.cpp index 7e9c2bcaf..2bf145f62 100644 --- a/src/tools/ecode/uibuildsettings.cpp +++ b/src/tools/ecode/uibuildsettings.cpp @@ -406,9 +406,10 @@ static const auto SETTINGS_PANEL_XML = R"xml( )xml"; -UIBuildSettings* UIBuildSettings::New( ProjectBuild& build, ProjectBuildConfiguration& config, - bool isNew ) { - return eeNew( UIBuildSettings, ( build, config, isNew ) ); +UIBuildSettings* UIBuildSettings::New( + ProjectBuild& build, ProjectBuildConfiguration& config, bool isNew, + const std::function onBuildNameChange ) { + return eeNew( UIBuildSettings, ( build, config, isNew, onBuildNameChange ) ); } UIBuildSettings::~UIBuildSettings() { @@ -420,9 +421,14 @@ UIBuildSettings::~UIBuildSettings() { sendCommonEvent( Event::OnConfirm ); } -UIBuildSettings::UIBuildSettings( ProjectBuild& build, ProjectBuildConfiguration& config, - bool isNew ) : - mBuild( build ), mConfig( config ), mOldName( mBuild.getName() ), mIsNew( isNew ) { +UIBuildSettings::UIBuildSettings( + ProjectBuild& build, ProjectBuildConfiguration& config, bool isNew, + const std::function onBuildNameChange ) : + mBuild( build ), + mConfig( config ), + mOldName( mBuild.getName() ), + mIsNew( isNew ), + mNewNameFn( onBuildNameChange ) { addClass( "build_settings" ); mUISceneNode->loadLayoutFromString( SETTINGS_PANEL_XML, this, String::hash( "build_settings" ) ); @@ -441,6 +447,10 @@ UIBuildSettings::UIBuildSettings( ProjectBuild& build, ProjectBuildConfiguration if ( idx != eeINDEX_NOT_FOUND ) panelBuildNameDDL->getListBox()->setItemText( idx, mBuild.getName() ); } + if ( mOldName == mConfig.buildName ) + mConfig.buildName = mBuild.getName(); + if ( mNewNameFn ) + mNewNameFn( mOldName, mBuild.getName() ); mOldName = mBuild.getName(); } ); diff --git a/src/tools/ecode/uibuildsettings.hpp b/src/tools/ecode/uibuildsettings.hpp index 69801ec9a..5bc4e0c17 100644 --- a/src/tools/ecode/uibuildsettings.hpp +++ b/src/tools/ecode/uibuildsettings.hpp @@ -11,8 +11,10 @@ namespace ecode { class UIBuildSettings : public UIRelativeLayout { public: - static UIBuildSettings* New( ProjectBuild& build, ProjectBuildConfiguration& config, - bool isNew ); + static UIBuildSettings* + + New( ProjectBuild& build, ProjectBuildConfiguration& config, bool isNew, + const std::function onBuildNameChange ); virtual ~UIBuildSettings(); @@ -32,8 +34,10 @@ class UIBuildSettings : public UIRelativeLayout { ProjectBuildOutputParserConfig mTmpOpCfg; bool mIsNew{ false }; bool mCanceled{ false }; + std::function mNewNameFn; - explicit UIBuildSettings( ProjectBuild& build, ProjectBuildConfiguration& config, bool isNew ); + explicit UIBuildSettings( ProjectBuild& build, ProjectBuildConfiguration& config, bool isNew, + const std::function onBuildNameChange ); void moveStepUp( size_t stepNum, bool isClea ); diff --git a/src/tools/ecode/universallocator.cpp b/src/tools/ecode/universallocator.cpp index 120c7f52d..5dbd31deb 100644 --- a/src/tools/ecode/universallocator.cpp +++ b/src/tools/ecode/universallocator.cpp @@ -213,8 +213,8 @@ void UniversalLocator::goToLine() { } static bool isCommand( const std::string& filename ) { - return !filename.empty() && - ( filename == "> " || filename == ": " || filename == "l " || filename == ". " ); + return !filename.empty() && ( filename == "> " || filename == ": " || filename == "l " || + filename == ". " || filename == "o " ); } void UniversalLocator::initLocateBar( UILocateBar* locateBar, UITextInput* locateInput ) { @@ -257,6 +257,8 @@ void UniversalLocator::initLocateBar( UILocateBar* locateBar, UITextInput* locat showCommandPalette(); } else if ( !inputTxt.empty() && mLocateInput->getText()[0] == ':' ) { showWorkspaceSymbol(); + } else if ( String::startsWith( inputTxt, "o " ) ) { + showOpenDocuments(); } else if ( String::startsWith( inputTxt, ". " ) ) { showDocumentSymbol(); } else { @@ -302,7 +304,8 @@ void UniversalLocator::initLocateBar( UILocateBar* locateBar, UITextInput* locat mSplitter->getCurEditor()->setFocus(); } if ( cmd != "open-locatebar" && cmd != "open-workspace-symbol-search" && - cmd != "open-document-symbol-search" && cmd != "go-to-line" ) { + cmd != "open-document-symbol-search" && cmd != "go-to-line" && + cmd != "show-open-documents" ) { hideLocateBar(); } else { mLocateInput->setFocus(); @@ -396,7 +399,7 @@ void UniversalLocator::showBar() { mLocateTable->setVisible( true ); const String& text = mLocateInput->getText(); - if ( !text.empty() && ( text[0] == '>' || text[0] == ':' ) ) { + if ( !text.empty() && ( text[0] == '>' || text[0] == ':' || text[0] == '.' ) ) { Int64 selectFrom = 1; if ( text.size() >= 2 && text[1] == ' ' ) selectFrom = 2; @@ -465,6 +468,65 @@ void UniversalLocator::showDocumentSymbol() { mApp->getStatusBar()->updateState(); } +void UniversalLocator::showOpenDocuments() { + showBar(); + + if ( mLocateInput->getText().empty() || mLocateInput->getText()[0] != 'o' ) + mLocateInput->setText( "o " ); + + if ( mLocateInput->getText().size() >= 2 ) + updateOpenDocumentsTable(); + updateLocateBar(); + mApp->getStatusBar()->updateState(); +} + +std::shared_ptr UniversalLocator::openDocumentsModel( const std::string& match ) { + std::map docs; + + mApp->getSplitter()->forEachDoc( [&docs]( TextDocument& doc ) { + if ( doc.hasFilepath() ) { + docs.insert( { FileSystem::fileNameFromPath( doc.getFilePath() ), doc.getFilePath() } ); + } + } ); + + std::vector files; + std::vector names; + + for ( const auto& doc : docs ) { + names.emplace_back( std::move( doc.first ) ); + files.emplace_back( std::move( doc.second ) ); + } + + if ( match.empty() ) + return std::make_shared( files, names ); + + std::multimap> matchesMap; + + for ( size_t i = 0; i < names.size(); i++ ) { + int matchName = String::fuzzyMatch( names[i], match ); + int matchPath = String::fuzzyMatch( files[i], match ); + matchesMap.insert( { std::max( matchName, matchPath ), i } ); + } + + std::vector ffiles; + std::vector fnames; + + for ( auto& res : matchesMap ) { + fnames.emplace_back( std::move( names[res.second] ) ); + ffiles.emplace_back( std::move( files[res.second] ) ); + } + + return std::make_shared( ffiles, fnames ); +} + +void UniversalLocator::updateOpenDocumentsTable() { + mLocateTable->setModel( + openDocumentsModel( mLocateInput->getText().substr( 2 ).trim().toUtf8() ) ); + if ( mLocateTable->getModel()->rowCount() > 0 ) + mLocateTable->getSelection().set( mLocateTable->getModel()->index( 0 ) ); + mLocateTable->scrollToTop(); +} + void UniversalLocator::onCodeEditorFocusChange( UICodeEditor* editor ) { if ( !mLocateTable || !mLocateTable->isVisible() ) return; @@ -633,6 +695,7 @@ std::vector UniversalLocator::getLocatorComma { "l ", mUISceneNode->i18n( "go_to_line_in_current_document", "Go To Line in Current Document" ), icon } ); + vec.push_back( { "o ", mUISceneNode->i18n( "open_documents", "Open Documents" ), icon } ); return vec; } diff --git a/src/tools/ecode/universallocator.hpp b/src/tools/ecode/universallocator.hpp index 4c8091d92..a42fd70ef 100644 --- a/src/tools/ecode/universallocator.hpp +++ b/src/tools/ecode/universallocator.hpp @@ -11,6 +11,7 @@ namespace ecode { class App; class LSPSymbolInfoModel; +class OpenDocumentsModel; class UniversalLocator { public: @@ -40,6 +41,8 @@ class UniversalLocator { void onCodeEditorFocusChange( UICodeEditor* editor ); + void showOpenDocuments(); + protected: UILocateBar* mLocateBarLayout{ nullptr }; UITableView* mLocateTable{ nullptr }; @@ -53,6 +56,7 @@ class UniversalLocator { std::string mCurDocURI; std::string mCurDocQuery; std::shared_ptr mTextDocumentSymbolModel{ nullptr }; + std::shared_ptr mOpenDocumentsModel{ nullptr }; void updateLocateBar(); @@ -78,6 +82,10 @@ class UniversalLocator { void asyncFuzzyMatchTextDocumentSymbol( const LSPSymbolInformationList& list, const std::string& query, const size_t& limit, std::function )> cb ); + + void updateOpenDocumentsTable(); + + std::shared_ptr openDocumentsModel( const std::string& match ); }; } // namespace ecode