mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Support object inspection through DAP variables request
This commit is contained in:
parent
5ccbf6e4c7
commit
6aac039ee7
3 changed files with 192 additions and 10 deletions
|
|
@ -442,26 +442,34 @@ Dictionary DebugAdapterParser::req_variables(const Dictionary &p_params) const {
|
|||
return Dictionary();
|
||||
}
|
||||
|
||||
Dictionary response = prepare_success_response(p_params), body;
|
||||
response["body"] = body;
|
||||
|
||||
Dictionary args = p_params["arguments"];
|
||||
int variable_id = args["variablesReference"];
|
||||
|
||||
HashMap<int, Array>::Iterator E = DebugAdapterProtocol::get_singleton()->variable_list.find(variable_id);
|
||||
if (HashMap<int, Array>::Iterator E = DebugAdapterProtocol::get_singleton()->variable_list.find(variable_id); E) {
|
||||
Dictionary response = prepare_success_response(p_params);
|
||||
Dictionary body;
|
||||
response["body"] = body;
|
||||
|
||||
if (E) {
|
||||
if (!DebugAdapterProtocol::get_singleton()->get_current_peer()->supportsVariableType) {
|
||||
for (int i = 0; i < E->value.size(); i++) {
|
||||
Dictionary variable = E->value[i];
|
||||
variable.erase("type");
|
||||
}
|
||||
}
|
||||
|
||||
body["variables"] = E ? E->value : Array();
|
||||
return response;
|
||||
} else {
|
||||
return Dictionary();
|
||||
// If the requested variable is an object, it needs to be requested from the debuggee.
|
||||
ObjectID object_id = DebugAdapterProtocol::get_singleton()->search_object_id(variable_id);
|
||||
|
||||
if (object_id.is_null()) {
|
||||
return prepare_error_response(p_params, DAP::ErrorType::UNKNOWN);
|
||||
}
|
||||
|
||||
DebugAdapterProtocol::get_singleton()->request_remote_object(object_id);
|
||||
}
|
||||
return Dictionary();
|
||||
}
|
||||
|
||||
Dictionary DebugAdapterParser::req_next(const Dictionary &p_params) const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue