1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:17:44 +00:00

HackStudio: Add evaluate expression popup to debugger

This implements a dialog that can be used to evaluate a JS expression
in the HackStudio's Debugger context. It also implements simple
C++ Variable <-> JS Value conversion, allowing for JS expressions
to read/write variables in the debugger scope.

Currently, C++ structs are mapped to JS objects by way of a JS proxy,
however this leads to issues when printing, so this will be changed
in a later commit.
This commit is contained in:
FalseHonesty 2021-04-12 21:02:47 -04:00 committed by Linus Groh
parent bee16bb83a
commit 60d329a186
7 changed files with 378 additions and 1 deletions

View file

@ -7,6 +7,7 @@
#include "Editor.h"
#include "Debugger/Debugger.h"
#include "Debugger/EvaluateExpressionDialog.h"
#include "EditorWrapper.h"
#include "HackStudio.h"
#include "Language.h"
@ -16,6 +17,7 @@
#include <LibCore/DirIterator.h>
#include <LibCore/File.h>
#include <LibCpp/SyntaxHighlighter.h>
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/GMLSyntaxHighlighter.h>
#include <LibGUI/INISyntaxHighlighter.h>
@ -42,6 +44,15 @@ Editor::Editor()
m_documentation_tooltip_window->set_rect(0, 0, 500, 400);
m_documentation_tooltip_window->set_window_type(GUI::WindowType::Tooltip);
m_documentation_page_view = m_documentation_tooltip_window->set_main_widget<Web::OutOfProcessWebView>();
m_evaluate_expression_action = GUI::Action::create("Evaluate expression", { Mod_Ctrl, Key_E }, [this](auto&) {
if (!execution_position().has_value()) {
GUI::MessageBox::show(window(), "Program is not running", "Error", GUI::MessageBox::Type::Error);
return;
}
auto dialog = EvaluateExpressionDialog::construct(window());
dialog->exec();
});
add_custom_context_menu_action(*m_evaluate_expression_action);
}
Editor::~Editor()