mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-30 10:06:35 +03:00
Some minor fixes in debugger and gitplugin.
Minor visual improvement in status bar.
This commit is contained in:
@@ -1573,6 +1573,13 @@
|
||||
../../src/tools/ecode/notificationcenter.cpp
|
||||
../../src/tools/ecode/notificationcenter.hpp
|
||||
../../src/tools/ecode/pathhelper.hpp
|
||||
../../src/tools/ecode/plugins/aiassistant/aiassistantplugin.cpp
|
||||
../../src/tools/ecode/plugins/aiassistant/aiassistantplugin.hpp
|
||||
../../src/tools/ecode/plugins/aiassistant/chatui.cpp
|
||||
../../src/tools/ecode/plugins/aiassistant/chatui.hpp
|
||||
../../src/tools/ecode/plugins/aiassistant/llmchatcompletionrequest.cpp
|
||||
../../src/tools/ecode/plugins/aiassistant/llmchatcompletionrequest.hpp
|
||||
../../src/tools/ecode/plugins/aiassistant/protocol.hpp
|
||||
../../src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp
|
||||
../../src/tools/ecode/plugins/autocomplete/autocompleteplugin.hpp
|
||||
../../src/tools/ecode/plugins/debugger/bus.cpp
|
||||
@@ -1585,6 +1592,11 @@
|
||||
../../src/tools/ecode/plugins/debugger/bussocketprocess.hpp
|
||||
../../src/tools/ecode/plugins/debugger/config.cpp
|
||||
../../src/tools/ecode/plugins/debugger/config.hpp
|
||||
../../src/tools/ecode/plugins/debugger/dap/debuggerclientdap.cpp
|
||||
../../src/tools/ecode/plugins/debugger/dap/debuggerclientdap.hpp
|
||||
../../src/tools/ecode/plugins/debugger/dap/messages.hpp
|
||||
../../src/tools/ecode/plugins/debugger/dap/protocol.cpp
|
||||
../../src/tools/ecode/plugins/debugger/dap/protocol.hpp
|
||||
../../src/tools/ecode/plugins/debugger/debuggerclient.cpp
|
||||
../../src/tools/ecode/plugins/debugger/debuggerclient.hpp
|
||||
../../src/tools/ecode/plugins/debugger/debuggerclientlistener.cpp
|
||||
@@ -1603,6 +1615,10 @@
|
||||
../../src/tools/ecode/plugins/debugger/models/variablesmodel.hpp
|
||||
../../src/tools/ecode/plugins/debugger/statusdebuggercontroller.cpp
|
||||
../../src/tools/ecode/plugins/debugger/statusdebuggercontroller.hpp
|
||||
../../src/tools/ecode/plugins/discordRPC/discordRPCplugin.cpp
|
||||
../../src/tools/ecode/plugins/discordRPC/discordRPCplugin.hpp
|
||||
../../src/tools/ecode/plugins/discordRPC/sdk/ipc.cpp
|
||||
../../src/tools/ecode/plugins/discordRPC/sdk/ipc.hpp
|
||||
../../src/tools/ecode/plugins/formatter/formatterplugin.cpp
|
||||
../../src/tools/ecode/plugins/formatter/formatterplugin.hpp
|
||||
../../src/tools/ecode/notificationcenter.cpp
|
||||
@@ -1614,6 +1630,7 @@
|
||||
../../src/tools/ecode/plugins/debugger/dap/protocol.cpp
|
||||
../../src/tools/ecode/plugins/debugger/dap/protocol.hpp
|
||||
../../src/tools/ecode/plugins/debugger/debuggerclientlistener.cpp
|
||||
../../src/tools/ecode/plugins/formatter/formatterplugin.hpp
|
||||
../../src/tools/ecode/plugins/git/git.cpp
|
||||
../../src/tools/ecode/plugins/git/git.hpp
|
||||
../../src/tools/ecode/plugins/git/gitbranchmodel.cpp
|
||||
|
||||
@@ -159,7 +159,7 @@ bool StyleSheetSelector::select( UIWidget* element, const bool& applyPseudo ) co
|
||||
|
||||
break; // continue evaluating
|
||||
}
|
||||
case StyleSheetSelectorRule::DIRECT_SIBLING: {
|
||||
case StyleSheetSelectorRule::PREVIOUS_SIBLING: {
|
||||
curElement = curElement->getStyleSheetPreviousSiblingElement();
|
||||
|
||||
if ( NULL == curElement || !selectorRule.matches( curElement, applyPseudo ) )
|
||||
@@ -167,7 +167,7 @@ bool StyleSheetSelector::select( UIWidget* element, const bool& applyPseudo ) co
|
||||
|
||||
break; // continue evaluating
|
||||
}
|
||||
case StyleSheetSelectorRule::PREVIOUS_SIBLING: {
|
||||
case StyleSheetSelectorRule::DIRECT_SIBLING: {
|
||||
curElement = curElement->getStyleSheetNextSiblingElement();
|
||||
|
||||
if ( NULL == curElement || !selectorRule.matches( curElement, applyPseudo ) )
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
namespace EE { namespace UI { namespace CSS {
|
||||
|
||||
// This will be optimized as popcnt
|
||||
static int numberOfSetBits( Uint32 i ) {
|
||||
i = i - ( ( i >> 1 ) & 0x55555555 ); // add pairs of bits
|
||||
i = ( i & 0x33333333 ) + ( ( i >> 2 ) & 0x33333333 ); // quads
|
||||
|
||||
@@ -65,7 +65,7 @@ StatusBar > #doc_info {
|
||||
margin-right: 0dp;
|
||||
border-radius: 0dp;
|
||||
border: 0dp solid transparent;
|
||||
padding: 0dp 4dp 0dp 4dp;
|
||||
padding: 0dp 6dp 0dp 6dp;
|
||||
opacity: 1;
|
||||
layout-gravity: center;
|
||||
layout-height: match_parent;
|
||||
@@ -73,6 +73,11 @@ StatusBar > #doc_info {
|
||||
}
|
||||
#doc_info {
|
||||
color: var(--font);
|
||||
border-right-color: transparent;
|
||||
}
|
||||
.status_but + #doc_info {
|
||||
border-right-width: 1dp;
|
||||
border-right-color: var(--tab-line);
|
||||
}
|
||||
#search_find.error,
|
||||
#search_replace.error {
|
||||
@@ -180,6 +185,9 @@ TableView#locate_bar_table > tableview::row:selected > tableview::cell:nth-child
|
||||
#status_bar > .status_but.selected {
|
||||
background-color: var(--primary);
|
||||
}
|
||||
#status_bar > .status_but:last-child {
|
||||
border-right-color: transparent;
|
||||
}
|
||||
.vertical_bar {
|
||||
background-color: var(--list-back);
|
||||
}
|
||||
|
||||
@@ -189,11 +189,41 @@ void AIAssistantPlugin::loadAIAssistantConfig( const std::string& path, bool upd
|
||||
}
|
||||
|
||||
if ( j.contains( "config" ) ) {
|
||||
// auto& config = j["config"];
|
||||
auto& config = j["config"];
|
||||
|
||||
if ( config.contains( "openai_api_key" ) )
|
||||
mApiKeys["openai"] = config.value( "openai_api_key", "" );
|
||||
else if ( updateConfigFile )
|
||||
config["openai_api_key"] = mApiKeys["openai"];
|
||||
|
||||
if ( config.contains( "anthropic_api_key" ) )
|
||||
mApiKeys["anthropic"] = config.value( "anthropic_api_key", "" );
|
||||
else if ( updateConfigFile )
|
||||
config["anthropic_api_key"] = mApiKeys["anthropic"];
|
||||
|
||||
if ( config.contains( "google_ai_api_key" ) )
|
||||
mApiKeys["google_ai"] = config.value( "google_ai_api_key", "" );
|
||||
else if ( updateConfigFile )
|
||||
config["google_ai_api_key"] = mApiKeys["google_ai"];
|
||||
|
||||
if ( config.contains( "deepseek_api_key" ) )
|
||||
mApiKeys["deepseek"] = config.value( "deepseek_api_key", "" );
|
||||
else if ( updateConfigFile )
|
||||
config["deepseek_api_key"] = mApiKeys["deepseek"];
|
||||
|
||||
if ( config.contains( "mistral_api_key" ) )
|
||||
mApiKeys["mistral"] = config.value( "mistral_api_key", "" );
|
||||
else if ( updateConfigFile )
|
||||
config["mistral_api_key"] = mApiKeys["mistral"];
|
||||
|
||||
if ( config.contains( "xai_api_key" ) )
|
||||
mApiKeys["xai"] = config.value( "xai_api_key", "" );
|
||||
else if ( updateConfigFile )
|
||||
config["xai_api_key"] = mApiKeys["xai"];
|
||||
}
|
||||
|
||||
if ( mKeyBindings.empty() ) {
|
||||
// mKeyBindings["new-ai-assistant"] = "mod+shift+n";
|
||||
mKeyBindings["new-ai-assistant"] = "mod+shift+n";
|
||||
}
|
||||
|
||||
auto& kb = j["keybindings"];
|
||||
@@ -220,8 +250,31 @@ void AIAssistantPlugin::loadAIAssistantConfig( const std::string& path, bool upd
|
||||
if ( mProviders.empty() ) {
|
||||
mProviders = std::move( providers );
|
||||
} else {
|
||||
for ( const auto& [key, value] : providers )
|
||||
mProviders.insert_or_assign( key, value );
|
||||
for ( const auto& [key, value] : providers ) {
|
||||
auto providerIt = mProviders.find( key );
|
||||
if ( providerIt != mProviders.end() ) {
|
||||
auto& provider = providerIt->second;
|
||||
provider.apiUrl = value.apiUrl;
|
||||
provider.name = value.name;
|
||||
provider.displayName = value.displayName;
|
||||
provider.enabled = value.enabled;
|
||||
provider.fetchModelsUrl = value.fetchModelsUrl;
|
||||
provider.openApi = value.openApi;
|
||||
provider.models = value.models;
|
||||
// Add model if not exists
|
||||
for ( auto& model : value.models ) {
|
||||
if ( std::find_if( provider.models.begin(), provider.models.end(),
|
||||
[&model]( const LLMModel& cmodel ) {
|
||||
return cmodel.provider == model.provider &&
|
||||
cmodel.name == model.name;
|
||||
} ) == provider.models.end() ) {
|
||||
provider.models.emplace_back( std::move( model ) );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mProviders.insert( { key, std::move( value ) } );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( getUISceneNode() )
|
||||
|
||||
@@ -30,6 +30,7 @@ class AIAssistantPlugin : public PluginBase {
|
||||
bool mUIInit{ false };
|
||||
UIWidget* mStatusBar{ nullptr };
|
||||
UIPushButton* mStatusButton{ nullptr };
|
||||
UnorderedMap<std::string, std::string> mApiKeys;
|
||||
|
||||
AIAssistantPlugin( PluginManager* pluginManager, bool sync );
|
||||
|
||||
|
||||
@@ -721,6 +721,9 @@ bool DebuggerClientDap::setBreakpoints( const std::string& path,
|
||||
bool DebuggerClientDap::setBreakpoints( const dap::Source& source,
|
||||
const std::vector<dap::SourceBreakpoint>& breakpoints,
|
||||
bool sourceModified ) {
|
||||
if ( breakpoints.empty() )
|
||||
return false;
|
||||
|
||||
nlohmann::json bpoints = nlohmann::json::array();
|
||||
for ( const auto& item : breakpoints )
|
||||
bpoints.push_back( item.toJson() );
|
||||
|
||||
@@ -486,6 +486,10 @@ struct GotoTarget {
|
||||
static std::vector<GotoTarget> parseList( const json& variables );
|
||||
};
|
||||
|
||||
using BreakpointsSet = EE::UnorderedSet<SourceBreakpointStateful>;
|
||||
|
||||
using BreakpointsHolder = EE::UnorderedMap<std::string, BreakpointsSet>;
|
||||
|
||||
} // namespace ecode::dap
|
||||
|
||||
template <> struct std::hash<ecode::dap::SourceBreakpoint> {
|
||||
@@ -510,6 +514,6 @@ template <> struct std::hash<ecode::dap::SourceBreakpointStateful> {
|
||||
breakpoint.hitCondition ? std::hash<std::string>()( *breakpoint.hitCondition ) : 0;
|
||||
size_t h5 = breakpoint.logMessage ? std::hash<std::string>()( *breakpoint.logMessage ) : 0;
|
||||
// size_t h6 = std::hash<bool>()( breakpoint.enabled );
|
||||
return hashCombine( h1, h2, h3, h4, h5/*, h6*/ );
|
||||
return hashCombine( h1, h2, h3, h4, h5 /*, h6*/ );
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "debuggerclientlistener.hpp"
|
||||
#include "../../notificationcenter.hpp"
|
||||
#include "../../statusappoutputcontroller.hpp"
|
||||
#include "debuggerclientlistener.hpp"
|
||||
#include "debuggerplugin.hpp"
|
||||
#include "models/stackmodel.hpp"
|
||||
#include "models/threadsmodel.hpp"
|
||||
@@ -193,8 +193,8 @@ void DebuggerClientListener::stateChanged( DebuggerClient::State state ) {
|
||||
void DebuggerClientListener::sendBreakpoints() {
|
||||
Lock l( mPlugin->mBreakpointsMutex );
|
||||
for ( const auto& fileBps : mPlugin->mBreakpoints ) {
|
||||
std::string path( fileBps.first );
|
||||
mClient->setBreakpoints( path, fromSet( fileBps.second ) );
|
||||
if ( !fileBps.second.empty() )
|
||||
mClient->setBreakpoints( fileBps.first, fromSet( fileBps.second ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include "debuggerplugin.hpp"
|
||||
#include "../../notificationcenter.hpp"
|
||||
#include "../../terminalmanager.hpp"
|
||||
#include "../../uistatusbar.hpp"
|
||||
@@ -6,7 +7,6 @@
|
||||
#include "bussocket.hpp"
|
||||
#include "bussocketprocess.hpp"
|
||||
#include "dap/debuggerclientdap.hpp"
|
||||
#include "debuggerplugin.hpp"
|
||||
#include "models/breakpointsmodel.hpp"
|
||||
#include "models/processesmodel.hpp"
|
||||
#include "models/variablesmodel.hpp"
|
||||
@@ -142,7 +142,7 @@ void DebuggerPlugin::onSaveProject( const std::string& /*projectFolder*/,
|
||||
std::string debugger( mCurDebugger );
|
||||
std::string configuration( mCurConfiguration );
|
||||
auto expressions( mExpressions );
|
||||
UnorderedMap<std::string, UnorderedSet<SourceBreakpointStateful>> breakpoints;
|
||||
BreakpointsHolder breakpoints;
|
||||
{
|
||||
Lock l( mBreakpointsMutex );
|
||||
breakpoints = mBreakpoints;
|
||||
@@ -169,7 +169,8 @@ void DebuggerPlugin::onSaveProject( const std::string& /*projectFolder*/,
|
||||
jbp["enabled"] = bp.enabled;
|
||||
bpArr.push_back( jbp );
|
||||
}
|
||||
bpsArr[bpSet.first] = std::move( bpArr );
|
||||
if ( !bpArr.empty() )
|
||||
bpsArr[bpSet.first] = std::move( bpArr );
|
||||
}
|
||||
config["breakpoints"] = std::move( bpsArr );
|
||||
|
||||
@@ -234,16 +235,18 @@ void DebuggerPlugin::onLoadProject( const std::string& projectFolder,
|
||||
}
|
||||
|
||||
if ( config.contains( "breakpoints" ) && config["breakpoints"].is_object() ) {
|
||||
UnorderedMap<std::string, UnorderedSet<SourceBreakpointStateful>> breakpoints;
|
||||
BreakpointsHolder breakpoints;
|
||||
for ( auto& [key, value] : config["breakpoints"].items() ) {
|
||||
auto& bps = breakpoints[key];
|
||||
if ( value.is_array() ) {
|
||||
BreakpointsSet set;
|
||||
for ( auto& jbp : value ) {
|
||||
SourceBreakpointStateful bp;
|
||||
bp.line = jbp.value( "line", 1 );
|
||||
bp.enabled = jbp.value( "enabled", true );
|
||||
bps.insert( std::move( bp ) );
|
||||
set.insert( std::move( bp ) );
|
||||
}
|
||||
if ( !set.empty() )
|
||||
breakpoints[key] = std::move( set );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class DebuggerPlugin : public PluginBase {
|
||||
public:
|
||||
static PluginDefinition Definition() {
|
||||
return { "debugger", "Debugger", "Debugger integration",
|
||||
DebuggerPlugin::New, { 0, 0, 1 }, DebuggerPlugin::NewSync };
|
||||
DebuggerPlugin::New, { 0, 0, 2 }, DebuggerPlugin::NewSync };
|
||||
}
|
||||
|
||||
static Plugin* New( PluginManager* pluginManager );
|
||||
@@ -103,7 +103,7 @@ class DebuggerPlugin : public PluginBase {
|
||||
UIDropDownList* mUIDebuggerList{ nullptr };
|
||||
UIDropDownList* mUIDebuggerConfList{ nullptr };
|
||||
UIPushButton* mRunButton{ nullptr };
|
||||
UnorderedMap<std::string, UnorderedSet<SourceBreakpointStateful>> mBreakpoints;
|
||||
BreakpointsHolder mBreakpoints;
|
||||
UnorderedSet<std::string> mPendingBreakpoints;
|
||||
std::shared_ptr<BreakpointsModel> mBreakpointsModel;
|
||||
Mutex mDapsMutex;
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
|
||||
namespace ecode {
|
||||
|
||||
BreakpointsModel::BreakpointsModel(
|
||||
const UnorderedMap<std::string, UnorderedSet<SourceBreakpointStateful>>& breakpoints,
|
||||
UISceneNode* sceneNode ) :
|
||||
BreakpointsModel::BreakpointsModel( const BreakpointsHolder& breakpoints, UISceneNode* sceneNode ) :
|
||||
mSceneNode( sceneNode ) {
|
||||
for ( const auto& bpf : breakpoints )
|
||||
for ( const auto& bp : bpf.second )
|
||||
|
||||
@@ -19,9 +19,7 @@ class BreakpointsModel : public Model {
|
||||
public:
|
||||
enum Columns { Enabled, SourcePath, Line, Remove, Count };
|
||||
|
||||
BreakpointsModel(
|
||||
const UnorderedMap<std::string, UnorderedSet<SourceBreakpointStateful>>& breakpoints,
|
||||
UISceneNode* sceneNode );
|
||||
BreakpointsModel( const BreakpointsHolder& breakpoints, UISceneNode* sceneNode );
|
||||
|
||||
virtual size_t rowCount( const ModelIndex& ) const;
|
||||
|
||||
@@ -41,6 +39,7 @@ class BreakpointsModel : public Model {
|
||||
void move( const std::string& doc, Int64 fromLine, Int64 toLine, Int64 numLines );
|
||||
|
||||
const std::pair<std::string, SourceBreakpointStateful>& get( ModelIndex index );
|
||||
|
||||
protected:
|
||||
std::vector<std::pair<std::string, SourceBreakpointStateful>> mBreakpoints;
|
||||
UISceneNode* mSceneNode{ nullptr };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "gitbranchmodel.hpp"
|
||||
#include "gitplugin.hpp"
|
||||
#include "gitbranchmodel.hpp"
|
||||
#include "gitstatusmodel.hpp"
|
||||
#include <eepp/graphics/primitives.hpp>
|
||||
#include <eepp/scene/scenemanager.hpp>
|
||||
@@ -360,11 +360,15 @@ void GitPlugin::updateStatusBarSync() {
|
||||
else if ( mGitStatus.totalInserts || mGitStatus.totalDeletions )
|
||||
mPanelSwicher->getListBox()->setSelected( 1 );
|
||||
} );
|
||||
}
|
||||
|
||||
if ( mStatusBar->getChildCount() >= 2 &&
|
||||
mStatusButton->getNodeIndex() != mStatusBar->getChildCount() - 2 )
|
||||
mStatusButton->toPosition( mStatusBar->getChildCount() - 2 );
|
||||
if ( mStatusBar->getNextNode() == nullptr ||
|
||||
mStatusBar->getNextNode()->getId() != "doc_info" ) {
|
||||
auto docInfo = mStatusBar->find( "doc_info" );
|
||||
if ( docInfo != nullptr && docInfo->getParent() == mStatusButton->getParent() ) {
|
||||
mStatusButton->toPosition( docInfo->getNodeIndex() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mStatusButton->setVisible( !mGit->getGitFolder().empty() );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user