<commit_before>#include "ScriptEditor.hpp"

#include <Engine/Script/ScriptFile.hpp>
#include <Engine/Hymn.hpp>
#include <Engine/Util/FileSystem.hpp>
#include <Engine/Manager/Managers.hpp>
#include <Engine/Manager/ScriptManager.hpp>
#include <Editor/Util/EditorSettings.hpp>
#include <imgui.h>

using namespace GUI;

void ScriptEditor::Show() {
    if (ImGui::Begin(("Script: " + std::to_string(reinterpret_cast<uintptr_t>(script))).c_str(), &visible)) {
        char nameText[255];
        strcpy(nameText, script->name.c_str());
        if (ImGui::InputText("Name", nameText, 255))
            script->name = nameText;
        
        if (ImGui::Button("Edit Script")) {
            std::string filename = Hymn().GetPath() + FileSystem::DELIMITER + "Scripts" + FileSystem::DELIMITER + script->name + ".as";
            FileSystem::ExecuteProgram(EditorSettings::GetInstance().GetString("Text Editor"), "\"" + filename + "\"");
        }
        
        if (ImGui::Button("Build Script"))
            Managers().scriptManager->BuildScript(script->name);
    }
    ImGui::End();
}

void ScriptEditor::SetScript(ScriptFile* script) {
    this->script = script;
}

bool ScriptEditor::IsVisible() const {
    return visible;
}

void ScriptEditor::SetVisible(bool visible) {
    this->visible = visible;
}<commit_msg>Display name in script editor<commit_after>#include "ScriptEditor.hpp"

#include <Engine/Script/ScriptFile.hpp>
#include <Engine/Hymn.hpp>
#include <Engine/Util/FileSystem.hpp>
#include <Engine/Manager/Managers.hpp>
#include <Engine/Manager/ScriptManager.hpp>
#include <Editor/Util/EditorSettings.hpp>
#include <imgui.h>

using namespace GUI;

void ScriptEditor::Show() {
    if (ImGui::Begin(("Script: " + script->name).c_str(), &visible)) {
        char nameText[255];
        strcpy(nameText, script->name.c_str());
        if (ImGui::InputText("Name", nameText, 255))
            script->name = nameText;
        
        if (ImGui::Button("Edit Script")) {
            std::string filename = Hymn().GetPath() + FileSystem::DELIMITER + "Scripts" + FileSystem::DELIMITER + script->name + ".as";
            FileSystem::ExecuteProgram(EditorSettings::GetInstance().GetString("Text Editor"), "\"" + filename + "\"");
        }
        
        if (ImGui::Button("Build Script"))
            Managers().scriptManager->BuildScript(script->name);
    }
    ImGui::End();
}

void ScriptEditor::SetScript(ScriptFile* script) {
    this->script = script;
}

bool ScriptEditor::IsVisible() const {
    return visible;
}

void ScriptEditor::SetVisible(bool visible) {
    this->visible = visible;
}
{'fraction_non_alphanumeric': 0.16429942418426105, 'fraction_numerical': 0.004606525911708253, 'mean_word_length': 3.721014492753623, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2220044', 'n_tokens_mistral': 804, 'n_tokens_neox': 793, 'n_words': 142}