mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-04 20:46:29 +03:00
Fix Node::removeActionsByTag and Node::getActionsByTag using the wrong tag type (and in consequence not removing anything whe requested, generating crashes on some cases). Improved LSP restart stability, although I still can crash it on some rare cases, haven't found the problem yet.
This commit is contained in:
@@ -334,11 +334,11 @@ class EE_API Node : public Transformable {
|
||||
|
||||
bool removeActions( const std::vector<Action*>& actions );
|
||||
|
||||
bool removeActionsByTag( const String::HashType& tag );
|
||||
bool removeActionsByTag( const Action::UniqueID& tag );
|
||||
|
||||
std::vector<Action*> getActions();
|
||||
|
||||
std::vector<Action*> getActionsByTag( const Uint32& tag );
|
||||
std::vector<Action*> getActionsByTag( const Action::UniqueID& tag );
|
||||
|
||||
void clearActions();
|
||||
|
||||
|
||||
@@ -1567,7 +1567,7 @@ bool Node::removeActions( const std::vector<Action*>& actions ) {
|
||||
return getActionManager()->removeActions( actions );
|
||||
}
|
||||
|
||||
bool Node::removeActionsByTag( const String::HashType& tag ) {
|
||||
bool Node::removeActionsByTag( const Action::UniqueID& tag ) {
|
||||
return getActionManager()->removeActionsByTagFromTarget( this, tag );
|
||||
}
|
||||
|
||||
@@ -1575,7 +1575,7 @@ std::vector<Action*> Node::getActions() {
|
||||
return getActionManager()->getActionsFromTarget( this );
|
||||
}
|
||||
|
||||
std::vector<Action*> Node::getActionsByTag( const Uint32& tag ) {
|
||||
std::vector<Action*> Node::getActionsByTag( const Action::UniqueID& tag ) {
|
||||
return getActionManager()->getActionsByTagFromTarget( this, tag );
|
||||
}
|
||||
|
||||
|
||||
@@ -1737,9 +1737,8 @@ bool LSPClientPlugin::onCreateContextMenu( UICodeEditor* editor, UIPopUpMenu* me
|
||||
addFn( "lsp-switch-header-source",
|
||||
i18n( "lsp_switch_header_source", "Switch Header/Source" ), "filetype-hpp" );
|
||||
|
||||
String restartStr( i18n( "lsp_restart_lsp_server", "Restart LSP Server" ) + " (" +
|
||||
server->getDefinition().name + ")" );
|
||||
addFn( "lsp-plugin-restart", restartStr, "refresh" );
|
||||
addFn( "lsp-plugin-restart", i18n( "lsp_restart_lsp_server", "Restart LSP Server" ),
|
||||
"refresh" );
|
||||
|
||||
#ifdef EE_DEBUG
|
||||
if ( server->getDefinition().name == "clangd" )
|
||||
|
||||
@@ -1245,6 +1245,10 @@ LSPClientServer::~LSPClientServer() {
|
||||
shutdown();
|
||||
std::unique_lock<std::mutex> lock( mShutdownMutex );
|
||||
mShutdownCond.wait_for( lock, std::chrono::milliseconds( 275 ), [this]() { return !mReady; } );
|
||||
|
||||
if ( mUsingProcess )
|
||||
mProcess.kill();
|
||||
|
||||
eeSAFE_DELETE( mSocket );
|
||||
{
|
||||
Lock l( mClientsMutex );
|
||||
|
||||
@@ -230,6 +230,7 @@ void LSPClientServerManager::renameSymbol( const URI& uri, const TextPosition& p
|
||||
}
|
||||
|
||||
bool LSPClientServerManager::isServerRunning( const LSPClientServer* server ) {
|
||||
Lock l( mClientsMutex );
|
||||
for ( const auto& svr : mClients ) {
|
||||
if ( server == svr.second.get() ) {
|
||||
if ( mErasingClients.find( svr.first ) != mErasingClients.end() )
|
||||
@@ -285,6 +286,7 @@ void LSPClientServerManager::run( const std::shared_ptr<TextDocument>& doc ) {
|
||||
}
|
||||
|
||||
size_t LSPClientServerManager::clientCount() const {
|
||||
Lock l( mClientsMutex );
|
||||
return mClients.size();
|
||||
}
|
||||
|
||||
@@ -320,6 +322,7 @@ void LSPClientServerManager::updateDirty() {
|
||||
// Kill server only after N seconds of inactivity
|
||||
if ( server.second->getElapsedTime() > mLSPDecayTime ) {
|
||||
// If a document was opened while waiting, remove the server from the queue
|
||||
Lock l( mClientsMutex );
|
||||
auto clientServer = mClients.find( server.first );
|
||||
if ( clientServer != mClients.end() && clientServer->second->hasDocuments() ) {
|
||||
invalidatedClose.push_back( server.first );
|
||||
|
||||
@@ -111,7 +111,7 @@ class LSPClientServerManager {
|
||||
std::map<String::HashType, std::unique_ptr<Clock>> mLSPsToClose;
|
||||
LSPWorkspaceFolder mLSPWorkspaceFolder;
|
||||
Clock mUpdateClock;
|
||||
Mutex mClientsMutex;
|
||||
mutable Mutex mClientsMutex;
|
||||
Time mLSPDecayTime{ Minutes( 1 ) };
|
||||
|
||||
std::vector<LSPDefinition> supportsLSP( const std::shared_ptr<TextDocument>& doc );
|
||||
|
||||
Reference in New Issue
Block a user