From c9507c2cba1264ba4d7e8f151dd50ad3c27440f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Thu, 26 Jun 2025 20:45:56 -0300 Subject: [PATCH] Allow supporting multiple "type"s per DAP. Should fix macOS build. --- bin/assets/plugins/debugger.json | 2 +- src/tools/ecode/plugins/debugger/config.hpp | 4 ++++ .../ecode/plugins/debugger/debuggerplugin.cpp | 20 +++++++++++++++---- .../ecode/plugins/debugger/debuggerplugin.hpp | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/bin/assets/plugins/debugger.json b/bin/assets/plugins/debugger.json index d25570927..2fca1d720 100644 --- a/bin/assets/plugins/debugger.json +++ b/bin/assets/plugins/debugger.json @@ -242,7 +242,7 @@ { "name": "node", "url": "https://github.com/microsoft/vscode-js-debug", - "type": "pwa-node", + "type": ["pwa-node", "pwa-chrome"], "run": { "command": "node", "command_arguments": [ "${env:VSCODE_JS_DEBUG_PATH}/src/dapDebugServer.js", "${randPort}", "127.0.0.1" ] diff --git a/src/tools/ecode/plugins/debugger/config.hpp b/src/tools/ecode/plugins/debugger/config.hpp index 6efafa8be..2f4075f77 100644 --- a/src/tools/ecode/plugins/debugger/config.hpp +++ b/src/tools/ecode/plugins/debugger/config.hpp @@ -27,6 +27,10 @@ struct Command { }; struct Connection { + Connection() {} + + Connection( int port, std::string host ) : port( port ), host( std::move( host ) ) {} + int port; std::string host; bool isValid() const; diff --git a/src/tools/ecode/plugins/debugger/debuggerplugin.cpp b/src/tools/ecode/plugins/debugger/debuggerplugin.cpp index 2d1055a9c..cf7d218d6 100644 --- a/src/tools/ecode/plugins/debugger/debuggerplugin.cpp +++ b/src/tools/ecode/plugins/debugger/debuggerplugin.cpp @@ -467,7 +467,15 @@ void DebuggerPlugin::loadDAPConfig( const std::string& path, bool updateConfigFi for ( const auto& dap : dapArr ) { DapTool dapTool; dapTool.name = dap.value( "name", "" ); - dapTool.type = dap.value( "type", "" ); + + if ( dap.contains( "type" ) && dap["type"].is_array() ) { + for ( const auto& obj : dap["type"] ) + if ( obj.is_string() ) + dapTool.type.emplace_back( obj.get() ); + } else if ( dap.contains( "type" ) && dap["type"].is_string() ) { + dapTool.type.emplace_back( dap.value( "type", "" ) ); + } + dapTool.url = dap.value( "url", "" ); if ( dap.contains( "run" ) ) { @@ -600,8 +608,9 @@ void DebuggerPlugin::loadProjectConfiguration( const std::string& path ) { DapConfig dapConfig; auto type = conf.value( "type", "" ); - if ( !std::any_of( mDaps.begin(), mDaps.end(), - [&type]( const DapTool& dap ) { return dap.type == type; } ) ) + if ( !std::any_of( mDaps.begin(), mDaps.end(), [&type]( const DapTool& dap ) { + return dap.type.end() != std::find( dap.type.begin(), dap.type.end(), type ); + } ) ) continue; dapConfig.name = conf.value( "name", "" ); @@ -1109,7 +1118,10 @@ void DebuggerPlugin::updateDebuggerConfigurationList() { { Lock l( mDapsMutex ); for ( const auto& conf : mDapConfigs ) { - if ( conf.args.value( "type", "" ) != debuggerIt->type ) + auto type( conf.args.value( "type", "" ) ); + + if ( std::find( debuggerIt->type.begin(), debuggerIt->type.end(), type ) == + debuggerIt->type.end() ) continue; confNames.emplace_back( conf.name ); diff --git a/src/tools/ecode/plugins/debugger/debuggerplugin.hpp b/src/tools/ecode/plugins/debugger/debuggerplugin.hpp index 5a647eee5..d176ec39a 100644 --- a/src/tools/ecode/plugins/debugger/debuggerplugin.hpp +++ b/src/tools/ecode/plugins/debugger/debuggerplugin.hpp @@ -28,7 +28,7 @@ struct DapConfig { struct DapTool { std::string name; std::string url; - std::string type; + std::vector type; std::vector languagesSupported; DapRunConfig run; std::vector configurations;