feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -144,9 +144,7 @@ Dictionary DebugAdapterParser::req_initialize(const Dictionary &p_params) const
// Send all current breakpoints
List<String> breakpoints;
ScriptEditor::get_singleton()->get_breakpoints(&breakpoints);
for (List<String>::Element *E = breakpoints.front(); E; E = E->next()) {
String breakpoint = E->get();
for (const String &breakpoint : breakpoints) {
String path = breakpoint.left(breakpoint.find_char(':', 6)); // Skip initial part of path, aka "res://"
int line = breakpoint.substr(path.size()).to_int();
@ -301,12 +299,11 @@ Dictionary DebugAdapterParser::req_threads(const Dictionary &p_params) const {
Dictionary response = prepare_success_response(p_params), body;
response["body"] = body;
Array arr;
DAP::Thread thread;
thread.id = 1; // Hardcoded because Godot only supports debugging one thread at the moment
thread.name = "Main";
arr.push_back(thread.to_json());
Array arr = { thread.to_json() };
body["threads"] = arr;
return response;
@ -325,8 +322,7 @@ Dictionary DebugAdapterParser::req_stackTrace(const Dictionary &p_params) const
Array arr;
DebugAdapterProtocol *dap = DebugAdapterProtocol::get_singleton();
for (const KeyValue<DAP::StackFrame, List<int>> &E : dap->stackframe_list) {
DAP::StackFrame sf = E.key;
for (DAP::StackFrame sf : dap->stackframe_list) {
if (!lines_at_one) {
sf.line--;
}
@ -360,7 +356,7 @@ Dictionary DebugAdapterParser::req_setBreakpoints(const Dictionary &p_params) co
// If path contains \, it's a Windows path, so we need to convert it to /, and make the drive letter uppercase
if (source.path.contains_char('\\')) {
source.path = source.path.replace("\\", "/");
source.path = source.path.replace_char('\\', '/');
source.path = source.path.substr(0, 1).to_upper() + source.path.substr(1);
}
@ -372,6 +368,8 @@ Dictionary DebugAdapterParser::req_setBreakpoints(const Dictionary &p_params) co
lines.push_back(breakpoint.line + !lines_at_one);
}
// Always update the source checksum for the requested path, as it might have been modified externally.
DebugAdapterProtocol::get_singleton()->update_source(source.path);
Array updated_breakpoints = DebugAdapterProtocol::get_singleton()->update_breakpoints(source.path, lines);
body["breakpoints"] = updated_breakpoints;
@ -383,13 +381,12 @@ Dictionary DebugAdapterParser::req_breakpointLocations(const Dictionary &p_param
response["body"] = body;
Dictionary args = p_params["arguments"];
Array locations;
DAP::BreakpointLocation location;
location.line = args["line"];
if (args.has("endLine")) {
location.endLine = args["endLine"];
}
locations.push_back(location.to_json());
Array locations = { location.to_json() };
body["breakpoints"] = locations;
return response;
@ -403,15 +400,13 @@ Dictionary DebugAdapterParser::req_scopes(const Dictionary &p_params) const {
int frame_id = args["frameId"];
Array scope_list;
DAP::StackFrame frame;
frame.id = frame_id;
HashMap<DAP::StackFrame, List<int>, DAP::StackFrame>::Iterator E = DebugAdapterProtocol::get_singleton()->stackframe_list.find(frame);
HashMap<DebugAdapterProtocol::DAPStackFrameID, Vector<int>>::Iterator E = DebugAdapterProtocol::get_singleton()->scope_list.find(frame_id);
if (E) {
ERR_FAIL_COND_V(E->value.size() != 3, prepare_error_response(p_params, DAP::ErrorType::UNKNOWN));
List<int>::ConstIterator itr = E->value.begin();
for (int i = 0; i < 3; ++itr, ++i) {
const Vector<int> &scope_ids = E->value;
ERR_FAIL_COND_V(scope_ids.size() != 3, prepare_error_response(p_params, DAP::ErrorType::UNKNOWN));
for (int i = 0; i < 3; ++i) {
DAP::Scope scope;
scope.variablesReference = *itr;
scope.variablesReference = scope_ids[i];
switch (i) {
case 0:
scope.name = "Locals";
@ -595,8 +590,7 @@ Dictionary DebugAdapterParser::ev_stopped_breakpoint(const int &p_id) const {
body["reason"] = "breakpoint";
body["description"] = "Breakpoint";
Array breakpoints;
breakpoints.push_back(p_id);
Array breakpoints = { p_id };
body["hitBreakpointIds"] = breakpoints;
return event;