mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-31 18:46:29 +03:00
Some minor fixes in debugger and gitplugin.
Minor visual improvement in status bar.
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user