Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed declaration file errors #135

Merged
merged 2 commits into from
Aug 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tools/editor_tools.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "editor_tools.h"
#include "../ecmascript_language.h"
#include "core/math/expression.h"
#include "core/os/keyboard.h"
#include "editor/filesystem_dock.h"

#define TS_IGNORE "//@ts-ignore\n"
Expand Down Expand Up @@ -156,6 +157,7 @@ static String format_doc_text(const String &p_bbcode, const String &p_indent = "
line = line.replace("[constant ", "`");
line = line.replace("[", "`");
line = line.replace("]", "`");
line = line.replace("*/", "* /"); // To solve issues with accidental multiline comment ends
}

if (!in_code_block && i < lines.size() - 1) {
Expand Down Expand Up @@ -606,6 +608,17 @@ void ECMAScriptPlugin::_export_typescript_declare_file(const String &p_path) {
dict["description"] = format_doc_text(enums[i]->description, "\t\t\t ");
dict["name"] = format_property_name(enums[i]->name);
dict["value"] = enums[i]->value;

// Exceptions

/**
* KEY_MASK_CMD docs has value listed as "platform-dependent",
* so we have to retreive the actual value manually
*/
if (dict["name"] == "KEY_MASK_CMD") {
dict["value"] = KEY_MASK_CMD;
}

enum_str += apply_pattern(const_str, dict);
}
enum_str += "\t}\n";
Expand Down