From bd2e707e2f5b00255b495918d850c0ebfb36b0dd Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 5 Apr 2019 23:15:12 +0200 Subject: [PATCH] Add support for type hints in non-default script editor templates This also refactors template processing to avoid repetition. This closes #27074. (cherry picked from commit 00799fc8c245a09259fda8d17e65428a904402c6) --- editor/editor_settings.cpp | 6 +-- modules/gdscript/gdscript.h | 1 + modules/gdscript/gdscript_editor.cpp | 59 ++++++++++++++++------------ 3 files changed, 38 insertions(+), 28 deletions(-) diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 5c257b86dbb..b9ed63c1b68 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -675,14 +675,14 @@ bool EditorSettings::_save_text_editor_theme(String p_file) { static Dictionary _get_builtin_script_templates() { Dictionary templates; - //No Comments + // No Comments templates["no_comments.gd"] = "extends %BASE%\n" "\n" - "func _ready():\n" + "func _ready()%VOID_RETURN%:\n" "%TS%pass\n"; - //Empty + // Empty templates["empty.gd"] = "extends %BASE%" "\n" diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index ded873c7d31..c67e390e32e 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -444,6 +444,7 @@ public: virtual void get_reserved_words(List *p_words) const; virtual void get_comment_delimiters(List *p_delimiters) const; virtual void get_string_delimiters(List *p_delimiters) const; + virtual String _get_processed_template(const String &p_template, const String &p_base_class_name) const; virtual Ref