@@ -799,6 +799,22 @@ void DebugAdapterProtocol::parse_object(SceneDebuggerObject &p_obj) {
799799 variable_list.insert (object_list[object_id], properties);
800800}
801801
802+ void DebugAdapterProtocol::parse_evaluation (DebuggerMarshalls::ScriptStackVariable &p_var) {
803+ // If the eval is not on the pending list, we weren't expecting it. Ignore it.
804+ String eval = p_var.name ;
805+ if (!eval_pending_list.erase (eval)) {
806+ return ;
807+ }
808+
809+ DAP::Variable variable;
810+ variable.name = p_var.name ;
811+ variable.value = p_var.value ;
812+ variable.type = Variant::get_type_name (p_var.value .get_type ());
813+ variable.variablesReference = parse_variant (p_var.value );
814+
815+ eval_list.insert (variable.name , variable);
816+ }
817+
802818const Variant DebugAdapterProtocol::parse_object_variable (const SceneDebuggerObject::SceneDebuggerProperty &p_property) {
803819 const PropertyInfo &info = p_property.first ;
804820 const Variant &value = p_property.second ;
@@ -833,6 +849,18 @@ bool DebugAdapterProtocol::request_remote_object(const ObjectID &p_object_id) {
833849 return true ;
834850}
835851
852+ bool DebugAdapterProtocol::request_remote_evaluate (const String &p_eval, int p_stack_frame) {
853+ // If the eval is already on the pending list, we don't need to request it again
854+ if (eval_pending_list.has (p_eval)) {
855+ return false ;
856+ }
857+
858+ EditorDebuggerNode::get_singleton ()->get_default_debugger ()->request_remote_evaluate (p_eval, p_stack_frame);
859+ eval_pending_list.insert (p_eval);
860+
861+ return true ;
862+ }
863+
836864bool DebugAdapterProtocol::process_message (const String &p_text) {
837865 JSON json;
838866 ERR_FAIL_COND_V_MSG (json.parse (p_text) != OK, true , " Malformed message!" );
@@ -1148,6 +1176,12 @@ void DebugAdapterProtocol::on_debug_data(const String &p_msg, const Array &p_dat
11481176 remote_obj.deserialize (p_data);
11491177
11501178 parse_object (remote_obj);
1179+ } else if (p_msg == " evaluation_return" ) {
1180+ // An evaluation was requested from the debuggee; parse it.
1181+ DebuggerMarshalls::ScriptStackVariable remote_evaluation;
1182+ remote_evaluation.deserialize (p_data);
1183+
1184+ parse_evaluation (remote_evaluation);
11511185 }
11521186
11531187 notify_custom_data (p_msg, p_data);
0 commit comments