Ups, staged the wrong files:

Improved ThreadPool.
ecode: Make consistent the find/search highlighting with the actual results (Closes SpartanJ/ecode#73).
Fixed $NPROC in LSP client commands.
This commit is contained in:
Martín Lucas Golini
2023-03-10 02:37:01 -03:00
parent 85b5711119
commit 5aef110bda
22 changed files with 277 additions and 106 deletions

View File

@@ -142,12 +142,10 @@ void AutoCompletePlugin::onRegister( UICodeEditor* editor ) {
std::string oldLang = event->getOldLang();
std::string newLang = event->getNewLang();
#if AUTO_COMPLETE_THREADED
mPool->run(
[&, oldLang, newLang] {
updateLangCache( oldLang );
updateLangCache( newLang );
},
[] {} );
mPool->run( [&, oldLang, newLang] {
updateLangCache( oldLang );
updateLangCache( newLang );
} );
#else
updateLangCache( oldLang );
updateLangCache( newLang );
@@ -589,7 +587,7 @@ void AutoCompletePlugin::update( UICodeEditor* ) {
continue;
}
#if AUTO_COMPLETE_THREADED
mPool->run( [&, doc] { updateDocCache( doc ); }, [] {} );
mPool->run( [&, doc] { updateDocCache( doc ); } );
#else
updateDocCache( doc );
#endif
@@ -980,8 +978,7 @@ void AutoCompletePlugin::updateSuggestions( const std::string& symbol, UICodeEdi
{
#if AUTO_COMPLETE_THREADED
mPool->run(
[this, symbol, symbols, editor] { runUpdateSuggestions( symbol, symbols, editor ); },
[] {} );
[this, symbol, symbols, editor] { runUpdateSuggestions( symbol, symbols, editor ); } );
#else
runUpdateSuggestions( symbol, symbols, editor );
#endif

View File

@@ -37,7 +37,7 @@ FormatterPlugin::FormatterPlugin( PluginManager* pluginManager, bool sync ) :
load( pluginManager );
} else {
#if FORMATTER_THREADED
mPool->run( [&, pluginManager] { load( pluginManager ); }, [] {} );
mPool->run( [&, pluginManager] { load( pluginManager ); } );
#else
load( pluginManager );
#endif

View File

@@ -36,7 +36,7 @@ LinterPlugin::LinterPlugin( PluginManager* pluginManager, bool sync ) :
load( pluginManager );
} else {
#if LINTER_THREADED
mPool->run( [&, pluginManager] { load( pluginManager ); }, [] {} );
mPool->run( [&, pluginManager] { load( pluginManager ); } );
#else
load( pluginManager );
#endif
@@ -440,7 +440,7 @@ void LinterPlugin::update( UICodeEditor* editor ) {
if ( it != mDirtyDoc.end() && it->second->getElapsedTime() >= mDelayTime ) {
mDirtyDoc.erase( doc.get() );
#if LINTER_THREADED
mPool->run( [&, doc] { lintDoc( doc ); }, [] {} );
mPool->run( [&, doc] { lintDoc( doc ); } );
#else
lintDoc( doc );
#endif

View File

@@ -121,7 +121,7 @@ LSPClientPlugin::LSPClientPlugin( PluginManager* pluginManager, bool sync ) :
if ( sync ) {
load( pluginManager );
} else {
mThreadPool->run( [&, pluginManager] { load( pluginManager ); }, [] {} );
mThreadPool->run( [&, pluginManager] { load( pluginManager ); } );
}
}
@@ -174,7 +174,7 @@ static LSPURIAndServer getServerURIFromTextDocumentURI( LSPClientServerManager&
return { uri, manager.getOneLSPClientServer( uri ) };
}
static void sanitizeCommand( std::string cmd ) {
static void sanitizeCommand( std::string& cmd ) {
String::replaceAll( cmd, "$NPROC", String::toString( Sys::getCPUCount() ) );
}

View File

@@ -187,7 +187,7 @@ void LSPClientServerManager::applyWorkspaceEdit(
}
void LSPClientServerManager::run( const std::shared_ptr<TextDocument>& doc ) {
mThreadPool->run( [&, doc]() { tryRunServer( doc ); }, []() {} );
mThreadPool->run( [&, doc]() { tryRunServer( doc ); } );
}
size_t LSPClientServerManager::clientCount() const {