Implemented advanced features of DAP
Respect client "supportsVariableType" capability Implement "breakpointLocations" request Implement "restart" request Implement "evaluate" request Fix error messages not being shown, and improved wrong path message Removed thread option and behavior Implemented detailed inspection of complex variables Fix "const"ness of functions Added a configurable timeout for requests Implement Godot custom data request/event Implement syncing of breakpoints Added support for debugging native platforms
This commit is contained in:
parent
d8a8d32f2e
commit
292ed61c18
20 changed files with 845 additions and 67 deletions
|
|
@ -37,6 +37,7 @@
|
|||
#include "core/os/keyboard.h"
|
||||
#include "core/os/os.h"
|
||||
#include "editor/debugger/editor_debugger_node.h"
|
||||
#include "editor/debugger/script_editor_debugger.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_run_script.h"
|
||||
#include "editor/editor_scale.h"
|
||||
|
|
@ -486,6 +487,29 @@ void ScriptEditor::_clear_execution(REF p_script) {
|
|||
}
|
||||
}
|
||||
|
||||
void ScriptEditor::_set_breakpoint(REF p_script, int p_line, bool p_enabled) {
|
||||
Ref<Script> script = Object::cast_to<Script>(*p_script);
|
||||
if (script.is_valid() && (script->has_source_code() || script->get_path().is_resource_file())) {
|
||||
if (edit(p_script, p_line, 0, false)) {
|
||||
editor->push_item(p_script.ptr());
|
||||
|
||||
ScriptEditorBase *se = _get_current_editor();
|
||||
if (se) {
|
||||
se->set_breakpoint(p_line, p_enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptEditor::_clear_breakpoints() {
|
||||
for (int i = 0; i < tab_container->get_child_count(); i++) {
|
||||
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
|
||||
if (se) {
|
||||
se->clear_breakpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScriptEditorBase *ScriptEditor::_get_current_editor() const {
|
||||
int selected = tab_container->get_current_tab();
|
||||
if (selected < 0 || selected >= tab_container->get_child_count()) {
|
||||
|
|
@ -3488,6 +3512,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
|
|||
debugger->connect("set_execution", callable_mp(this, &ScriptEditor::_set_execution));
|
||||
debugger->connect("clear_execution", callable_mp(this, &ScriptEditor::_clear_execution));
|
||||
debugger->connect("breaked", callable_mp(this, &ScriptEditor::_breaked));
|
||||
debugger->get_default_debugger()->connect("set_breakpoint", callable_mp(this, &ScriptEditor::_set_breakpoint));
|
||||
debugger->get_default_debugger()->connect("clear_breakpoints", callable_mp(this, &ScriptEditor::_clear_breakpoints));
|
||||
|
||||
menu_hb->add_spacer();
|
||||
|
||||
|
|
|
|||
|
|
@ -152,6 +152,8 @@ public:
|
|||
virtual void tag_saved_version() = 0;
|
||||
virtual void reload(bool p_soft) {}
|
||||
virtual Array get_breakpoints() = 0;
|
||||
virtual void set_breakpoint(int p_line, bool p_enabled) = 0;
|
||||
virtual void clear_breakpoints() = 0;
|
||||
virtual void add_callback(const String &p_function, PackedStringArray p_args) = 0;
|
||||
virtual void update_settings() = 0;
|
||||
virtual void set_debugger_active(bool p_active) = 0;
|
||||
|
|
@ -370,6 +372,8 @@ class ScriptEditor : public PanelContainer {
|
|||
void _breaked(bool p_breaked, bool p_can_debug);
|
||||
void _update_window_menu();
|
||||
void _script_created(Ref<Script> p_script);
|
||||
void _set_breakpoint(REF p_scrpt, int p_line, bool p_enabled);
|
||||
void _clear_breakpoints();
|
||||
|
||||
ScriptEditorBase *_get_current_editor() const;
|
||||
Array _get_open_script_editors() const;
|
||||
|
|
|
|||
|
|
@ -1370,6 +1370,14 @@ Array ScriptTextEditor::get_breakpoints() {
|
|||
return code_editor->get_text_editor()->get_breakpointed_lines();
|
||||
}
|
||||
|
||||
void ScriptTextEditor::set_breakpoint(int p_line, bool p_enabled) {
|
||||
code_editor->get_text_editor()->set_line_as_breakpoint(p_line, p_enabled);
|
||||
}
|
||||
|
||||
void ScriptTextEditor::clear_breakpoints() {
|
||||
code_editor->get_text_editor()->clear_breakpointed_lines();
|
||||
}
|
||||
|
||||
void ScriptTextEditor::set_tooltip_request_func(String p_method, Object *p_obj) {
|
||||
code_editor->get_text_editor()->set_tooltip_request_func(p_obj, p_method, this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -224,6 +224,8 @@ public:
|
|||
|
||||
virtual void reload(bool p_soft) override;
|
||||
virtual Array get_breakpoints() override;
|
||||
virtual void set_breakpoint(int p_line, bool p_enabled) override;
|
||||
virtual void clear_breakpoints() override;
|
||||
|
||||
virtual void add_callback(const String &p_function, PackedStringArray p_args) override;
|
||||
virtual void update_settings() override;
|
||||
|
|
|
|||
|
|
@ -120,6 +120,8 @@ public:
|
|||
virtual void set_edit_state(const Variant &p_state) override;
|
||||
virtual Vector<String> get_functions() override;
|
||||
virtual Array get_breakpoints() override;
|
||||
virtual void set_breakpoint(int p_line, bool p_enabled) override{};
|
||||
virtual void clear_breakpoints() override{};
|
||||
virtual void goto_line(int p_line, bool p_with_error = false) override;
|
||||
void goto_line_selection(int p_line, int p_begin, int p_end);
|
||||
virtual void set_executing_line(int p_line) override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue