diff --git a/include/eepp/ui/doc/textdocument.hpp b/include/eepp/ui/doc/textdocument.hpp index 4dc595142..6e46f1c05 100644 --- a/include/eepp/ui/doc/textdocument.hpp +++ b/include/eepp/ui/doc/textdocument.hpp @@ -460,6 +460,7 @@ class EE_API TextDocument { std::vector mLines; TextRange mSelection; std::unordered_set mClients; + Mutex mClientsMutex; LineEnding mLineEnding{ LineEnding::LF }; std::atomic mLoading{ false }; std::atomic mLoadingAsync{ false }; diff --git a/src/eepp/ui/doc/syntaxdefinitionmanager.cpp b/src/eepp/ui/doc/syntaxdefinitionmanager.cpp index 929f0beb3..4ad5da2bf 100644 --- a/src/eepp/ui/doc/syntaxdefinitionmanager.cpp +++ b/src/eepp/ui/doc/syntaxdefinitionmanager.cpp @@ -464,7 +464,7 @@ void SyntaxDefinitionManager::addC() { { { "-?%d+[%d%.eE]*f?" }, "number" }, { { "-?%.?%d+f?" }, "number" }, { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { { "if", "keyword" }, { "then", "keyword" }, { "else", "keyword" }, @@ -539,7 +539,7 @@ void SyntaxDefinitionManager::addJavaScript() { { "normal", "keyword2", "function", "operator" } }, { { "([%w_][%w_]+)%.([%w_][%w%d_]*)%s*(=)%s*(async)%s*%f[(]" }, { "normal", "keyword2", "function", "operator", "function" } }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { { "arguments", "keyword2" }, { "async", "keyword" }, { "await", "keyword" }, @@ -636,7 +636,7 @@ void SyntaxDefinitionManager::addPython() { { { "-?%d+[%d%.eE]*" }, "number" }, { { "-?%.?%d+" }, "number" }, { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { @@ -886,7 +886,7 @@ void SyntaxDefinitionManager::addPHP() { { { "-?%d+[%d%.eE]*" }, "number" }, { { "-?%.?%d+" }, "number" }, { { "[%.%+%-=/%*%^%%<>!~|&]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, { { "%$[%a][%w_]*" }, "keyword2" }, }, @@ -1002,7 +1002,7 @@ void SyntaxDefinitionManager::addSQL() { { { "-?%d+[%d%.eE]*f?" }, "number" }, { { "-?%.?%d+f?" }, "number" }, { { "[%+%-=/%*%%<>!~|&@%?$#]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, symbols, @@ -1030,7 +1030,7 @@ void SyntaxDefinitionManager::addGLSL() { { { "dmat[2-4]" }, "keyword2" }, { { "mat[2-4]x[2-4]" }, "keyword2" }, { { "mat[2-4]" }, "keyword2" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { @@ -1428,7 +1428,7 @@ void SyntaxDefinitionManager::addCSharp() { { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, { { "%?%?" }, "operator" }, { { "%?%." }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { { "abstract", "keyword" }, { "as", "keyword" }, { "await", "keyword" }, @@ -1482,7 +1482,7 @@ void SyntaxDefinitionManager::addGo() { { { "-?%.?%d+f?" }, "number" }, { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, { { ":=" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { @@ -1520,7 +1520,7 @@ void SyntaxDefinitionManager::addRust() { { { "-?%d+[%d%.eE]*f?" }, "number" }, { { "-?%.?%d+f?" }, "number" }, { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { @@ -1560,7 +1560,7 @@ void SyntaxDefinitionManager::addGDScript() { { { "-?%d+[%d%.e]*" }, "number" }, { { "-?%.?%d+" }, "number" }, { { "[%+%:%-=/%*%^%%<>!~|&]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { @@ -1849,7 +1849,7 @@ void SyntaxDefinitionManager::addHLSL() { { { "double[1-9]x1[0-6]" }, "keyword2" }, { { "double1[0-6]x1[0-6]" }, "keyword2" }, { { "double[1-4]" }, "keyword2" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { @@ -2091,7 +2091,7 @@ void SyntaxDefinitionManager::addMeson() { { { "0x[%da-fA-F]+" }, "number" }, { { "-?%d+%d*" }, "number" }, { { "[%+%-=/%%%*!]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { @@ -2133,7 +2133,7 @@ void SyntaxDefinitionManager::addAngelScript() { { { "&out" }, "keyword" }, { { "[%a_][%w_]*@" }, "keyword2" }, { { "[%-%+!~@%?:&|%^<>%*/=%%]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { @@ -2249,7 +2249,7 @@ void SyntaxDefinitionManager::addJava() { { { "-?%d+[%d%.eE]*f?" }, "number" }, { { "-?%.?%d+f?" }, "number" }, { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { @@ -2320,7 +2320,7 @@ void SyntaxDefinitionManager::addSwift() { { { "-?%d+[%d%.eE]*f?" }, "number" }, { { "-?%.?%d+f?" }, "number" }, { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*[?!]?" }, "symbol" }, }, { @@ -2541,7 +2541,7 @@ void SyntaxDefinitionManager::addSolidity() { { { "-?%d+[%d%.eE]*f?" }, "number" }, { { "-?%.?%d+f?" }, "number" }, { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { { "if", "keyword" }, { "else", "keyword" }, @@ -2618,7 +2618,7 @@ void SyntaxDefinitionManager::addObjetiveC() { { { "-?%d+[%d%.eE]*f?" }, "number" }, { { "-?%.?%d+f?" }, "number" }, { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "@[%a_][%w_]*" }, "keyword2" }, { { "[%a_][%w_]*" }, "symbol" } }, { { "if", "keyword" }, { "then", "keyword" }, { "else", "keyword" }, @@ -2654,7 +2654,7 @@ void SyntaxDefinitionManager::addDart() { { { "%?%." }, "operator" }, { { "[%$%@]?\"", "\"", "\\" }, "string" }, { { "'\\x%x?%x?%x?%x'" }, "string" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { { "await", "keyword" }, { "bool", "keyword2" }, { "break", "keyword" }, @@ -2688,7 +2688,7 @@ void SyntaxDefinitionManager::addKotlin() { { { "-?%.?%d+f?" }, "number" }, { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, { { "%@[%a_][%w_]*" }, "function" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { { "if", "keyword" }, { "then", "keyword" }, @@ -2962,7 +2962,7 @@ void SyntaxDefinitionManager::addCMake() { { { "#", "[^\\]\n" }, "comment" }, { { "\"", "\"", "\\" }, "string" }, { { "'", "'", "\\" }, "string" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "CMAKE_[%w%d_]+" }, "keyword" }, { { "CTEST_[%w%d_]+" }, "keyword" }, { { "%u[%u%d_]*_[%u%d_]+" }, "keyword" }, @@ -2986,7 +2986,7 @@ void SyntaxDefinitionManager::addJSX() { { { "-?%d+[%d%.eE]*" }, "number" }, { { "-?%.?%d+" }, "number" }, { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { @@ -3060,7 +3060,7 @@ void SyntaxDefinitionManager::addOdin() { { { "[<>~=+-*/]=" }, "operator" }, { { "[%+%-=/%*%^%%<>!~|&:]" }, "operator" }, { { "%$[%a_][%w_]*" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[#@][%a_][%w_]*" }, "keyword2" }, { { "[#@]%b()" }, "keyword2" }, { { "[%a_][%w_]*" }, "symbol" }, @@ -3319,7 +3319,7 @@ void SyntaxDefinitionManager::addRuby() { { { "-?%d+[%d%.eE]*f?" }, "number" }, { { "-?%.?%d+f?" }, "number" }, { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "@?@[%a_][%w_]*" }, "keyword2" }, { { "::[%w_]*" }, "symbol" }, { { ":[%w_]*" }, "keyword2" }, @@ -3393,7 +3393,7 @@ void SyntaxDefinitionManager::addScala() { { { "-?%.?%d+" }, "number" }, { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, { { "[%a_][%w_]*\"\"\"*[%a_][%w_]*\"\"\"" }, "string" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%a_][%w_]*" }, "symbol" }, }, { @@ -3485,7 +3485,7 @@ void SyntaxDefinitionManager::addPerl() { { { "'", "'", "\\" }, "string" }, { { "-?%d+[%d%.eE]*" }, "number" }, { { "-?%.?%d+" }, "number" }, - { { "[%a_][%w_]*%s-%f[(]" }, "function" }, + { { "[%a_][%w_]*%f[(]" }, "function" }, { { "[%@%$%*]+[%a_][%w_]*" }, "keyword2" }, { { "%--[%a_][%w_]*" }, "symbol" }, }, diff --git a/src/eepp/ui/doc/textdocument.cpp b/src/eepp/ui/doc/textdocument.cpp index ec98eee84..30b3d4cb2 100644 --- a/src/eepp/ui/doc/textdocument.cpp +++ b/src/eepp/ui/doc/textdocument.cpp @@ -1056,12 +1056,14 @@ void TextDocument::textInput( const String& text ) { } void TextDocument::registerClient( Client* client ) { + Lock l( mClientsMutex ); mClients.insert( client ); if ( mActiveClient == nullptr ) setActiveClient( client ); } void TextDocument::unregisterClient( Client* client ) { + Lock l( mClientsMutex ); mClients.erase( client ); if ( mActiveClient == client ) setActiveClient( nullptr ); @@ -1985,72 +1987,84 @@ void TextDocument::setNonWordChars( const String& nonWordChars ) { } void TextDocument::notifyTextChanged( const DocumentContentChange& change ) { + Lock l( mClientsMutex ); for ( auto& client : mClients ) { client->onDocumentTextChanged( change ); } } void TextDocument::notifyCursorChanged() { + Lock l( mClientsMutex ); for ( auto& client : mClients ) { client->onDocumentCursorChange( getSelection().start() ); } } void TextDocument::notifySelectionChanged() { + Lock l( mClientsMutex ); for ( auto& client : mClients ) { client->onDocumentSelectionChange( getSelection() ); } } void TextDocument::notifyDocumentLoaded() { + Lock l( mClientsMutex ); for ( auto& client : mClients ) { client->onDocumentLoaded( this ); } } void TextDocument::notifyDocumentReloaded() { + Lock l( mClientsMutex ); for ( auto& client : mClients ) { client->onDocumentReloaded( this ); } } void TextDocument::notifyDocumentSaved() { + Lock l( mClientsMutex ); for ( auto& client : mClients ) { client->onDocumentSaved( this ); } } void TextDocument::notifyDocumentClosed() { + Lock l( mClientsMutex ); for ( auto& client : mClients ) { client->onDocumentClosed( this ); } } void TextDocument::notifyLineCountChanged( const size_t& lastCount, const size_t& newCount ) { + Lock l( mClientsMutex ); for ( auto& client : mClients ) { client->onDocumentLineCountChange( lastCount, newCount ); } } void TextDocument::notifyLineChanged( const Int64& lineIndex ) { + Lock l( mClientsMutex ); for ( auto& client : mClients ) { client->onDocumentLineChanged( lineIndex ); } } void TextDocument::notifyUndoRedo( const TextDocument::UndoRedo& eventType ) { + Lock l( mClientsMutex ); for ( auto& client : mClients ) { client->onDocumentUndoRedo( eventType ); } } void TextDocument::notifyDirtyOnFileSystem() { + Lock l( mClientsMutex ); for ( auto& client : mClients ) { client->onDocumentDirtyOnFileSystem( this ); } } void TextDocument::notifyDocumentMoved() { + Lock l( mClientsMutex ); for ( auto& client : mClients ) { client->onDocumentMoved( this ); } diff --git a/src/tools/ecode/plugins/linter/linterplugin.cpp b/src/tools/ecode/plugins/linter/linterplugin.cpp index 5422f1490..37668e4bf 100644 --- a/src/tools/ecode/plugins/linter/linterplugin.cpp +++ b/src/tools/ecode/plugins/linter/linterplugin.cpp @@ -713,7 +713,19 @@ void LinterPlugin::minimapDrawBeforeLineText( UICodeEditor* editor, const Int64& } } -bool LinterPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& pos, const Uint32& ) { +void LinterPlugin::tryHideHoveringMatch( UICodeEditor* editor ) { + if ( mHoveringMatch && editor->getTooltip() && editor->getTooltip()->isVisible() ) { + editor->setTooltipText( "" ); + editor->getTooltip()->hide(); + mHoveringMatch = false; + } +} + +bool LinterPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& pos, const Uint32& flags ) { + if ( flags != 0 ) { + tryHideHoveringMatch( editor ); + return false; + } Lock l( mMatchesMutex ); auto it = mMatches.find( editor->getDocumentRef().get() ); if ( it != mMatches.end() ) { @@ -725,11 +737,12 @@ bool LinterPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& pos, const for ( auto& match : matches ) { if ( match.box[editor].contains( localPos ) ) { mHoveringMatch = true; - editor->runOnMainThread( [&, editor] { + editor->runOnMainThread( [pos, match, editor] { editor->setTooltipText( match.text ); editor->getTooltip()->setHorizontalAlign( UI_HALIGN_LEFT ); editor->getTooltip()->setDontAutoHideOnMouseMove( true ); - editor->getTooltip()->setPixelsPosition( Vector2f( pos.x, pos.y ) ); + editor->getTooltip()->setPixelsPosition( pos.asFloat() + + PixelDensity::dpToPx( 1.f ) ); if ( !editor->getTooltip()->isVisible() ) editor->getTooltip()->show(); } ); @@ -737,20 +750,13 @@ bool LinterPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& pos, const } } } - if ( mHoveringMatch && editor->getTooltip() && editor->getTooltip()->isVisible() ) { - editor->setTooltipText( "" ); - editor->getTooltip()->hide(); - mHoveringMatch = false; - } + tryHideHoveringMatch( editor ); } return false; } bool LinterPlugin::onMouseLeave( UICodeEditor* editor, const Vector2i&, const Uint32& ) { - if ( mHoveringMatch && editor->getTooltip() && editor->getTooltip()->isVisible() ) { - editor->setTooltipText( "" ); - editor->getTooltip()->hide(); - } + tryHideHoveringMatch( editor ); return false; } diff --git a/src/tools/ecode/plugins/linter/linterplugin.hpp b/src/tools/ecode/plugins/linter/linterplugin.hpp index 8205909f0..e4418d1d9 100644 --- a/src/tools/ecode/plugins/linter/linterplugin.hpp +++ b/src/tools/ecode/plugins/linter/linterplugin.hpp @@ -83,7 +83,7 @@ class LinterPlugin : public UICodeEditorPlugin { void update( UICodeEditor* ); - bool onMouseMove( UICodeEditor*, const Vector2i&, const Uint32& ); + bool onMouseMove( UICodeEditor*, const Vector2i&, const Uint32& flags ); bool onMouseLeave( UICodeEditor*, const Vector2i&, const Uint32& ); @@ -152,6 +152,8 @@ class LinterPlugin : public UICodeEditorPlugin { void setMatches( TextDocument* doc, const MatchOrigin& origin, std::map>& matches ); + + void tryHideHoveringMatch( UICodeEditor* editor ); }; } // namespace ecode diff --git a/src/tools/ecode/plugins/lsp/lspclientplugin.cpp b/src/tools/ecode/plugins/lsp/lspclientplugin.cpp index ffd499859..5f6b985ee 100644 --- a/src/tools/ecode/plugins/lsp/lspclientplugin.cpp +++ b/src/tools/ecode/plugins/lsp/lspclientplugin.cpp @@ -468,7 +468,18 @@ TextPosition currentMouseTextPosition( UICodeEditor* editor ) { editor->getUISceneNode()->getWindow()->getInput()->getMousePosf() ); } -bool LSPClientPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& position, const Uint32& ) { +void LSPClientPlugin::tryHideTooltip( UICodeEditor* editor, const Vector2i& position ) { + TextPosition cursorPosition = editor->resolveScreenPosition( position.asFloat() ); + if ( mCurrentHover.range.isValid() && !mCurrentHover.range.contains( cursorPosition ) ) + hideTooltip( editor ); +} + +bool LSPClientPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& position, + const Uint32& flags ) { + if ( flags != 0 ) { + tryHideTooltip( editor, position ); + return false; + } String::HashType tag = String::hash( editor->getDocument().getFilePath() ); editor->removeActionsByTag( tag ); mEditorsTags[editor].insert( tag ); @@ -495,7 +506,8 @@ bool LSPClientPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& positio mCurrentHover = resp; editor->setTooltipText( resp.contents[0].value ); editor->getTooltip()->setHorizontalAlign( UI_HALIGN_LEFT ); - editor->getTooltip()->setPixelsPosition( position.asFloat() ); + editor->getTooltip()->setPixelsPosition( + position.asFloat() + PixelDensity::dpToPx( 1.f ) ); editor->getTooltip()->setDontAutoHideOnMouseMove( true ); if ( editor->hasFocus() && !editor->getTooltip()->isVisible() ) editor->getTooltip()->show(); @@ -506,9 +518,7 @@ bool LSPClientPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& positio } ); }, mHoverDelay, tag ); - TextPosition cursorPosition = editor->resolveScreenPosition( position.asFloat() ); - if ( !mCurrentHover.range.isValid() || !mCurrentHover.range.contains( cursorPosition ) ) - hideTooltip( editor ); + tryHideTooltip( editor, position ); return mCurrentHover.range.isValid() && editor->getTooltip() && editor->getTooltip()->isVisible(); } diff --git a/src/tools/ecode/plugins/lsp/lspclientplugin.hpp b/src/tools/ecode/plugins/lsp/lspclientplugin.hpp index 6bd6c9ec0..350cd494f 100644 --- a/src/tools/ecode/plugins/lsp/lspclientplugin.hpp +++ b/src/tools/ecode/plugins/lsp/lspclientplugin.hpp @@ -101,6 +101,8 @@ class LSPClientPlugin : public UICodeEditorPlugin { PluginRequestHandle processSignatureHelpRequest( const PluginMessage& msg ); PluginRequestHandle processCancelRequest( const PluginMessage& msg ); + + void tryHideTooltip( UICodeEditor* editor, const Vector2i& position ); }; } // namespace ecode diff --git a/src/tools/ecode/plugins/lsp/lspclientserver.cpp b/src/tools/ecode/plugins/lsp/lspclientserver.cpp index be0211a5f..68d3abe8f 100644 --- a/src/tools/ecode/plugins/lsp/lspclientserver.cpp +++ b/src/tools/ecode/plugins/lsp/lspclientserver.cpp @@ -889,6 +889,15 @@ bool LSPClientServer::registerDoc( const std::shared_ptr& doc ) { return true; } +void LSPClientServer::removeDoc( TextDocument* doc ) { + Lock l( mClientsMutex ); + if ( mClients.erase( doc ) > 0 ) { + auto it = std::find( mDocs.begin(), mDocs.end(), doc ); + if ( it != mDocs.end() ) + mDocs.erase( it ); + } +} + const LSPServerCapabilities& LSPClientServer::getCapabilities() const { return mCapabilities; } @@ -1049,15 +1058,6 @@ LSPClientServer::LSPRequestHandle LSPClientServer::didClose( const URI& document return send( newRequest( "textDocument/didClose", params ) ); } -void LSPClientServer::removeDoc( TextDocument* doc ) { - Lock l( mClientsMutex ); - if ( mClients.erase( doc ) > 0 ) { - auto it = std::find( mDocs.begin(), mDocs.end(), doc ); - if ( it != mDocs.end() ) - mDocs.erase( it ); - } -} - LSPClientServerManager* LSPClientServer::getManager() const { return mManager; } diff --git a/src/tools/ecode/plugins/lsp/lspdocumentclient.cpp b/src/tools/ecode/plugins/lsp/lspdocumentclient.cpp index 3228947aa..18cf4d5ad 100644 --- a/src/tools/ecode/plugins/lsp/lspdocumentclient.cpp +++ b/src/tools/ecode/plugins/lsp/lspdocumentclient.cpp @@ -57,7 +57,6 @@ void LSPDocumentClient::onDocumentReloaded( TextDocument* ) { auto version = ++mVersion; mServer->getThreadPool()->run( [server, doc, uri, version]() { server->didClose( uri ); - server->removeDoc( doc ); server->didOpen( doc, version ); } ); }