| 88 | } |
| 89 | |
| 90 | Ref<Script> GDScriptLanguage::make_template(const String &p_template, const String &p_class_name, const String &p_base_class_name) const { |
| 91 | Ref<GDScript> scr; |
| 92 | scr.instantiate(); |
| 93 | |
| 94 | String processed_template = p_template; |
| 95 | |
| 96 | #ifdef TOOLS_ENABLED |
| 97 | const bool type_hints = EditorSettings::get_singleton()->get_setting("text_editor/completion/add_type_hints"); |
| 98 | #else |
| 99 | const bool type_hints = true; |
| 100 | #endif |
| 101 | |
| 102 | if (!type_hints) { |
| 103 | processed_template = processed_template.replace(": int", "") |
| 104 | .replace(": Shader.Mode", "") |
| 105 | .replace(": VisualShader.Type", "") |
| 106 | .replace(": float", "") |
| 107 | .replace(": String", "") |
| 108 | .replace(": Array[String]", "") |
| 109 | .replace(": Node", "") |
| 110 | .replace(": CharFXTransform", "") |
| 111 | .replace(":=", "=") |
| 112 | .replace(" -> void", "") |
| 113 | .replace(" -> bool", "") |
| 114 | .replace(" -> int", "") |
| 115 | .replace(" -> PortType", "") |
| 116 | .replace(" -> String", "") |
| 117 | .replace(" -> Object", ""); |
| 118 | } |
| 119 | |
| 120 | processed_template = processed_template.replace("_BASE_", p_base_class_name) |
| 121 | .replace("_CLASS_SNAKE_CASE_", p_class_name.to_snake_case().validate_unicode_identifier()) |
| 122 | .replace("_CLASS_", p_class_name.to_pascal_case().validate_unicode_identifier()) |
| 123 | .replace("_TS_", _get_indentation()); |
| 124 | scr->set_source_code(processed_template); |
| 125 | |
| 126 | return scr; |
| 127 | } |
| 128 | |
| 129 | Vector<ScriptLanguage::ScriptTemplate> GDScriptLanguage::get_built_in_templates(const StringName &p_object) { |
| 130 | Vector<ScriptLanguage::ScriptTemplate> templates; |
nothing calls this directly
no test coverage detected