1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Allow configuring the script filename casing rule

Defaults to "Auto", which detects the casing based on the
preference of the currently selected language (C# for example
prefers PascalCase whereas GDScript prefers snake_case).
This commit is contained in:
RedMser
2023-06-11 18:23:48 +02:00
committed by Rémi Verschelde
parent a07dd0d6a5
commit 2bd714e34e
15 changed files with 103 additions and 57 deletions

View File

@@ -193,6 +193,10 @@ public:
class ScriptLanguage : public Object {
GDCLASS(ScriptLanguage, Object)
protected:
static void _bind_methods();
public:
virtual String get_name() const = 0;
@@ -224,6 +228,13 @@ public:
TEMPLATE_PROJECT
};
enum ScriptNameCasing {
SCRIPT_NAME_CASING_AUTO,
SCRIPT_NAME_CASING_PASCAL_CASE,
SCRIPT_NAME_CASING_SNAKE_CASE,
SCRIPT_NAME_CASING_KEBAB_CASE,
};
struct ScriptTemplate {
String inherit = "Object";
String name;
@@ -260,6 +271,7 @@ public:
virtual bool can_make_function() const { return true; }
virtual Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) { return ERR_UNAVAILABLE; }
virtual bool overrides_external_editor() { return false; }
virtual ScriptNameCasing preferred_file_name_casing() const { return SCRIPT_NAME_CASING_SNAKE_CASE; }
// Keep enums in sync with:
// scene/gui/code_edit.h - CodeEdit::CodeCompletionKind
@@ -405,6 +417,8 @@ public:
virtual ~ScriptLanguage() {}
};
VARIANT_ENUM_CAST(ScriptLanguage::ScriptNameCasing);
extern uint8_t script_encryption_key[32];
class PlaceHolderScriptInstance : public ScriptInstance {