From 7f4b9ef11f6997773081471c6ebab98d36aa4dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Thu, 31 Dec 2020 15:14:32 -0300 Subject: [PATCH] Linter bug fix. Minor optimization in Auto Complete module. Updated creator project. --- projects/linux/ee.creator.user | 195 +------------------- src/tools/codeeditor/autocompletemodule.cpp | 6 +- src/tools/codeeditor/lintermodule.cpp | 17 +- src/tools/codeeditor/lintermodule.hpp | 7 +- 4 files changed, 19 insertions(+), 206 deletions(-) diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index a23376646..6689a86cc 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -44,7 +44,7 @@ true 2 true - true + false 0 true false @@ -78,6 +78,7 @@ Builtin.Questionable + false true 0 @@ -114,11 +115,8 @@ ProjectExplorer.ProcessStep - - false eepp-test make - false true GenericProjectManager.GenericMakeStep @@ -152,11 +150,7 @@ ../../make/linux - - false -e config=release_x86_64 eepp-test - - false true GenericProjectManager.GenericMakeStep @@ -197,11 +191,7 @@ ProjectExplorer.ProcessStep - - false - /usr/bin/make - false true GenericProjectManager.GenericMakeStep @@ -241,11 +231,7 @@ ProjectExplorer.ProcessStep - - false -e config=release_x86_64 - - false true GenericProjectManager.GenericMakeStep @@ -278,11 +264,8 @@ ../../projects/mingw32 - - false -e config=debug_x86 make.sh - false true GenericProjectManager.GenericMakeStep @@ -315,11 +298,8 @@ ../../projects/mingw32 - - false -e config=release_x86 make.sh - false true GenericProjectManager.GenericMakeStep @@ -352,11 +332,8 @@ ../../make/linux - - false eepp-sound make - false true GenericProjectManager.GenericMakeStep @@ -389,11 +366,8 @@ ../../make/linux - - false eepp-sprites make - false true GenericProjectManager.GenericMakeStep @@ -426,11 +400,8 @@ ../../make/linux - - false eepp-fonts make - false true GenericProjectManager.GenericMakeStep @@ -463,11 +434,8 @@ ../../make/linux - - false eepp-vbo-fbo-batch make - false true GenericProjectManager.GenericMakeStep @@ -500,11 +468,8 @@ ../../make/linux - - false eepp-physics make - false true GenericProjectManager.GenericMakeStep @@ -537,11 +502,8 @@ ../../make/linux - - false eepp-http-request make - false true GenericProjectManager.GenericMakeStep @@ -574,11 +536,7 @@ ../../make/linux - - false eepp-static - - false true GenericProjectManager.GenericMakeStep @@ -619,11 +577,8 @@ ProjectExplorer.ProcessStep - - false eeiv make - false true GenericProjectManager.GenericMakeStep @@ -656,11 +611,8 @@ ../../make/linux - - false eepp-ui-hello-world make - false true GenericProjectManager.GenericMakeStep @@ -693,11 +645,7 @@ ../../make/linux - - false -e config=release_x86_64 eepp-static - - false true GenericProjectManager.GenericMakeStep @@ -731,11 +679,7 @@ ../../make/linux - - false eepp-shared - - false true GenericProjectManager.GenericMakeStep @@ -769,11 +713,7 @@ ../../make/linux - - false -e config=release_x86_64 eepp-shared - - false true GenericProjectManager.GenericMakeStep @@ -814,11 +754,7 @@ ProjectExplorer.ProcessStep - - false eepp-ew - - false true Clone of GenericProjectManager.GenericMakeStep @@ -853,11 +789,7 @@ ../../make/linux - - false -e config=release_x86_64 eepp-ew - - false true Clone of Make GenericProjectManager.GenericMakeStep @@ -892,11 +824,7 @@ ../../make/linux - - false eepp-es - - false true Clone of GenericProjectManager.GenericMakeStep @@ -931,11 +859,7 @@ ../../make/linux - - false -e config=release_x86_64 eepp-es - - false true Clone of Make GenericProjectManager.GenericMakeStep @@ -981,7 +905,6 @@ ProjectExplorer.DefaultDeployConfiguration 1 - dwarf @@ -1047,17 +970,12 @@ eepp-test-debug ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false false false %{buildDir}../../../bin/ - dwarf @@ -1124,17 +1042,12 @@ eepp-test-release ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false false false %{buildDir}../../../bin/ - dwarf @@ -1201,17 +1114,12 @@ eepp-physics-debug ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false true false %{buildDir}../../../bin/ - dwarf @@ -1278,17 +1186,12 @@ eepp-http-request-debug ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false true false %{buildDir}../../../bin/ - dwarf @@ -1355,17 +1258,12 @@ eeiv-debug ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false true false %{buildDir}../../../bin/ - dwarf @@ -1432,17 +1330,12 @@ eepp-TextureAtlasEditor-debug ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false false false %{buildDir}../../../bin/ - dwarf @@ -1510,16 +1403,12 @@ ProjectExplorer.CustomExecutableRunConfiguration -x assets/layouts/test.xml -c assets/layouts/test.css -u - false - true false - false false false false %{buildDir}../../../bin/ - dwarf @@ -1587,16 +1476,12 @@ ProjectExplorer.CustomExecutableRunConfiguration -x assets/layouts/test_widgets.xml -c assets/ui/breeze.css - false - true false - false false false false %{buildDir}../../../bin/ - dwarf @@ -1663,17 +1548,12 @@ eepp-ui-hello-world-debug ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false true false %{buildDir}../../../bin/ - dwarf @@ -1741,16 +1621,12 @@ ProjectExplorer.CustomExecutableRunConfiguration -p assets/ui/uitheme/ -o textureatlas.eta -u --allow-childs - false - true false - false false false false %{buildDir}../../../bin/ - dwarf @@ -1817,17 +1693,12 @@ eepp-ui-perf-test-debug ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false false false %{buildDir}../../../bin/ - dwarf @@ -1895,16 +1766,12 @@ ProjectExplorer.CustomExecutableRunConfiguration ../ - false - true false - false false false false %{buildDir}../../../bin/ - dwarf @@ -1971,17 +1838,12 @@ eepp-empty-window-debug ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false false false %{buildDir}../../../bin/ - dwarf @@ -2048,17 +1910,12 @@ eepp-empty-window-release ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false false false %{buildDir}../../../bin/ - dwarf @@ -2125,17 +1982,12 @@ eepp-external-shader-debug ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false true false %{buildDir}../../../bin/ - dwarf @@ -2202,17 +2054,12 @@ eepp-external-shader-release ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false true false %{buildDir}../../../bin/ - dwarf @@ -2279,17 +2126,12 @@ eepp-sound-debug ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false true true %{buildDir}../../../bin/ - dwarf @@ -2356,17 +2198,12 @@ eepp-sprites-debug ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false true false %{buildDir}../../../bin/ - dwarf @@ -2433,17 +2270,12 @@ eepp-fonts-debug ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false true false %{buildDir}../../../bin/ - dwarf @@ -2510,17 +2342,12 @@ eepp-vbo-fbo-batch-debug ProjectExplorer.CustomExecutableRunConfiguration - - false - true false - false false true false %{buildDir}../../../bin/ - 20 @@ -2542,10 +2369,6 @@ all - false - - - false true GenericProjectManager.GenericMakeStep @@ -2559,10 +2382,6 @@ clean - false - - - false true GenericProjectManager.GenericMakeStep @@ -2592,7 +2411,6 @@ ProjectExplorer.DefaultDeployConfiguration 1 - dwarf @@ -2654,19 +2472,12 @@ 2 - ProjectExplorer.CustomExecutableRunConfiguration - - false - false true - false false true - - 1 diff --git a/src/tools/codeeditor/autocompletemodule.cpp b/src/tools/codeeditor/autocompletemodule.cpp index 3657ea3c4..f8b1dd279 100644 --- a/src/tools/codeeditor/autocompletemodule.cpp +++ b/src/tools/codeeditor/autocompletemodule.cpp @@ -32,7 +32,7 @@ AutoCompleteModule::~AutoCompleteModule() { Lock l( mDocMutex ); Lock l2( mLangSymbolsMutex ); Lock l3( mSuggestionsMutex ); - for ( auto editor : mEditors ) { + for ( const auto& editor : mEditors ) { for ( auto listener : editor.second ) editor.first->removeEventListener( listener ); editor.first->unregisterModule( this ); @@ -199,7 +199,7 @@ void AutoCompleteModule::updateDocCache( TextDocument* doc ) { { Lock l( mLangSymbolsMutex ); lang.clear(); - for ( auto d : mDocCache ) { + for ( const auto& d : mDocCache ) { if ( d.first->getSyntaxDefinition().getLanguageName() == langName ) lang.insert( d.second.symbols.begin(), d.second.symbols.end() ); } @@ -214,7 +214,7 @@ void AutoCompleteModule::updateLangCache( const std::string& langName ) { Lock l( mLangSymbolsMutex ); Lock l2( mDocMutex ); lang.clear(); - for ( auto d : mDocCache ) { + for ( const auto& d : mDocCache ) { if ( d.first->getSyntaxDefinition().getLanguageName() == langName ) lang.insert( d.second.symbols.begin(), d.second.symbols.end() ); } diff --git a/src/tools/codeeditor/lintermodule.cpp b/src/tools/codeeditor/lintermodule.cpp index 7d3633ae4..159f65534 100644 --- a/src/tools/codeeditor/lintermodule.cpp +++ b/src/tools/codeeditor/lintermodule.cpp @@ -149,10 +149,10 @@ void LinterModule::onUnregister( UICodeEditor* editor ) { } void LinterModule::update( UICodeEditor* editor ) { - TextDocument* doc = editor->getDocumentRef().get(); - auto it = mDirtyDoc.find( doc ); + std::shared_ptr doc = editor->getDocumentRef(); + auto it = mDirtyDoc.find( doc.get() ); if ( it != mDirtyDoc.end() && it->second->getElapsedTime() >= mDelayTime ) { - mDirtyDoc.erase( doc ); + mDirtyDoc.erase( doc.get() ); #if LINTER_THREADED mPool->run( [&, doc] { lintDoc( doc ); }, [] {} ); #endif @@ -175,7 +175,7 @@ static std::string randString( size_t len ) { return str.substr( 0, len ); } -void LinterModule::lintDoc( TextDocument* doc ) { +void LinterModule::lintDoc( std::shared_ptr doc ) { auto linter = supportsLinter( doc ); if ( linter.command.empty() ) return; @@ -200,7 +200,8 @@ void LinterModule::lintDoc( TextDocument* doc ) { } } -void LinterModule::runLinter( TextDocument* doc, const Linter& linter, const std::string& path ) { +void LinterModule::runLinter( std::shared_ptr doc, const Linter& linter, + const std::string& path ) { Clock clock; std::string cmd( linter.command ); String::replaceAll( cmd, "$FILENAME", path ); @@ -271,10 +272,10 @@ void LinterModule::runLinter( TextDocument* doc, const Linter& linter, const std { Lock matchesLock( mMatchesMutex ); - mMatches[doc] = matches; + mMatches[doc.get()] = matches; } - invalidateEditors( doc ); + invalidateEditors( doc.get() ); Log::info( "LinterModule::runLinter for %s took %.2fms", path.c_str(), clock.getElapsedTime().asMilliseconds() ); @@ -357,7 +358,7 @@ bool LinterModule::onMouseLeave( UICodeEditor* editor, const Vector2i&, const Ui return false; } -Linter LinterModule::supportsLinter( TextDocument* doc ) { +Linter LinterModule::supportsLinter( std::shared_ptr doc ) { std::string filePath( doc->getFilePath() ); std::string extension( FileSystem::fileExtension( filePath ) ); if ( extension.empty() ) { diff --git a/src/tools/codeeditor/lintermodule.hpp b/src/tools/codeeditor/lintermodule.hpp index 162bb8d3f..c2408b9cb 100644 --- a/src/tools/codeeditor/lintermodule.hpp +++ b/src/tools/codeeditor/lintermodule.hpp @@ -73,11 +73,12 @@ class LinterModule : public UICodeEditorModule { void load( const std::string& lintersPath ); - void lintDoc( TextDocument* doc ); + void lintDoc( std::shared_ptr doc ); - void runLinter( TextDocument* doc, const Linter& linter, const std::string& path ); + void runLinter( std::shared_ptr doc, const Linter& linter, + const std::string& path ); - Linter supportsLinter( TextDocument* doc ); + Linter supportsLinter( std::shared_ptr doc ); void setDocDirty( TextDocument* doc );