From da4386ddff519e5c4b71b9ba5206e56bf1ae4964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Thu, 10 Apr 2025 18:40:46 -0300 Subject: [PATCH] Address: Specifying non-existing working directory for a build step isn't handled properly (SpartanJ/ecode#432). ChatUI hide tooltips after button click. Enable Tab Stops by default. --- src/tools/ecode/appconfig.cpp | 2 +- src/tools/ecode/appconfig.hpp | 2 +- .../ecode/plugins/aiassistant/chatui.cpp | 19 ++++++++-- src/tools/ecode/projectbuild.cpp | 36 ++++++++++++------- .../ecode/statusbuildoutputcontroller.cpp | 9 ++--- 5 files changed, 47 insertions(+), 21 deletions(-) diff --git a/src/tools/ecode/appconfig.cpp b/src/tools/ecode/appconfig.cpp index 4c513d26b..9f1fd97b8 100644 --- a/src/tools/ecode/appconfig.cpp +++ b/src/tools/ecode/appconfig.cpp @@ -141,7 +141,7 @@ void AppConfig::load( const std::string& confPath, std::string& keybindingsPath, doc.writeUnicodeBOM = ini.getValueB( "document", "write_bom", false ); doc.indentWidth = ini.getValueI( "document", "indent_width", 4 ); doc.indentSpaces = ini.getValueB( "document", "indent_spaces", false ); - doc.tabStops = ini.getValueB( "document", "tab_stops", false ); + doc.tabStops = ini.getValueB( "document", "tab_stops", true ); doc.lineEndings = TextFormat::stringToLineEnding( ini.getValue( "document", "line_endings", "LF" ) ); // Migrate old data diff --git a/src/tools/ecode/appconfig.hpp b/src/tools/ecode/appconfig.hpp index 7775a01b1..692dbd3b5 100644 --- a/src/tools/ecode/appconfig.hpp +++ b/src/tools/ecode/appconfig.hpp @@ -98,7 +98,7 @@ struct DocumentConfig { bool autoDetectIndentType{ true }; bool writeUnicodeBOM{ false }; bool indentSpaces{ false }; - bool tabStops{ false }; + bool tabStops{ true }; TextFormat::LineEnding lineEndings{ TextFormat::LineEnding::LF }; int indentWidth{ 4 }; int tabWidth{ 4 }; diff --git a/src/tools/ecode/plugins/aiassistant/chatui.cpp b/src/tools/ecode/plugins/aiassistant/chatui.cpp index 39d6f32ab..2d7114d7a 100644 --- a/src/tools/ecode/plugins/aiassistant/chatui.cpp +++ b/src/tools/ecode/plugins/aiassistant/chatui.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -214,7 +215,11 @@ LLMChatUI::LLMChatUI( PluginManager* manager ) : } mChatAdd = find( "llm_add_chat" ); - mChatAdd->onClick( [this]( auto ) { execute( "ai-add-chat" ); } ); + mChatAdd->onClick( [this]( auto ) { + execute( "ai-add-chat" ); + if ( mChatAdd->getTooltip() && mChatAdd->getTooltip()->isVisible() ) + mChatAdd->getTooltip()->hide(); + } ); const auto& markdown = SyntaxDefinitionManager::instance()->getByLSPName( "markdown" ); mChatInput->setShowFoldingRegion( true ); @@ -227,10 +232,18 @@ LLMChatUI::LLMChatUI( PluginManager* manager ) : mChatInput->setSyntaxDefinition( markdown ); mChatRun = find( "llm_run" ); - mChatRun->onClick( [this]( auto ) { execute( "ai-prompt" ); } ); + mChatRun->onClick( [this]( auto ) { + execute( "ai-prompt" ); + if ( mChatRun->getTooltip() && mChatRun->getTooltip()->isVisible() ) + mChatRun->getTooltip()->hide(); + } ); mChatStop = find( "llm_stop" ); - mChatStop->onClick( [this]( auto ) { execute( "ai-prompt-stop" ); } ); + mChatStop->onClick( [this]( auto ) { + execute( "ai-prompt-stop" ); + if ( mChatStop->getTooltip() && mChatStop->getTooltip()->isVisible() ) + mChatStop->getTooltip()->hide(); + } ); mChatUserRole = find( "llm_user" ); mChatUserRole->onClick( [this]( auto ) { execute( "ai-chat-toggle-role" ); } ); diff --git a/src/tools/ecode/projectbuild.cpp b/src/tools/ecode/projectbuild.cpp index d333c8af3..756944561 100644 --- a/src/tools/ecode/projectbuild.cpp +++ b/src/tools/ecode/projectbuild.cpp @@ -936,19 +936,31 @@ void ProjectBuildManager::runBuild( const std::string& buildName, const std::str } if ( progressFn ) { - progressFn( - progress, - Sys::getDateTimeStr() + ": " + - String::format( i18n( "starting_process", "Starting %s %s\n" ).toUtf8().c_str(), - cmd.cmd.c_str(), cmd.args.c_str() ), - nullptr ); + progressFn( progress, + Sys::getDateTimeStr() + ": " + + String::format( i18n( "starting_process", "Starting %s %s\n" ).toUtf8(), + cmd.cmd, cmd.args ), + nullptr ); - progressFn( - progress, - Sys::getDateTimeStr() + ": " + - String::format( i18n( "working_dir_at", "Working Dir %s\n" ).toUtf8().c_str(), - cmd.workingDir.c_str() ), - nullptr ); + if ( FileSystem::fileExists( cmd.workingDir ) ) { + progressFn( + progress, + Sys::getDateTimeStr() + ": " + + String::format( i18n( "working_dir_at", "Working Dir %s\n" ).toUtf8(), + cmd.workingDir ), + nullptr ); + } else { + progressFn( + progress, + Sys::getDateTimeStr() + ": " + + String::format( + i18n( + "working_dir_at_does_not_exists", + "WARNING: Working Dir is set to \"%s\" but it does not exists!\n" ) + .toUtf8(), + cmd.workingDir ), + nullptr ); + } } if ( mProcess->create( cmd.cmd, cmd.args, options, toUnorderedMap( res.envs ), diff --git a/src/tools/ecode/statusbuildoutputcontroller.cpp b/src/tools/ecode/statusbuildoutputcontroller.cpp index 291ab7922..7bd904042 100644 --- a/src/tools/ecode/statusbuildoutputcontroller.cpp +++ b/src/tools/ecode/statusbuildoutputcontroller.cpp @@ -1,7 +1,7 @@ +#include "statusbuildoutputcontroller.hpp" #include "notificationcenter.hpp" #include "plugins/plugincontextprovider.hpp" #include "projectdirectorytree.hpp" -#include "statusbuildoutputcontroller.hpp" #include "widgetcommandexecuter.hpp" #include @@ -141,10 +141,11 @@ void StatusBuildOutputController::runBuild( const std::string& buildName, } } - patterns.emplace_back( - SyntaxPattern( { "%d%d%d%d%-%d%d%-%d%d%s%d%d%:%d%d%:%d%d%:.*error.*[^\n]+" }, "error" ) ); patterns.emplace_back( SyntaxPattern( - { "%d%d%d%d%-%d%d%-%d%d%s%d%d%:%d%d%:%d%d%:.*warning.*[^\n]+" }, "warning" ) ); + { "%d%d%d%d%-%d%d%-%d%d%s%d%d%:%d%d%:%d%d%:.*[Ee][Rr][Rr][Oo][Rr].*[^\n]+" }, "error" ) ); + patterns.emplace_back( SyntaxPattern( + { "%d%d%d%d%-%d%d%-%d%d%s%d%d%:%d%d%:%d%d%:.*[Ww][Aa][Rr][Nn][Ii][Nn][Gg].*[^\n]+" }, + "warning" ) ); patterns.emplace_back( SyntaxPattern( { "%d%d%d%d%-%d%d%-%d%d%s%d%d%:%d%d%:%d%d%:[^\n]+" }, "notice" ) );