diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index cdc56e5ec51..83a4abb2279 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -493,11 +493,6 @@ void ScriptServer::save_global_classes() { //////////////////// -ScriptCodeCompletionCache *ScriptCodeCompletionCache::singleton = nullptr; -ScriptCodeCompletionCache::ScriptCodeCompletionCache() { - singleton = this; -} - void ScriptLanguage::get_core_type_words(List *p_core_type_words) const { p_core_type_words->push_back("String"); p_core_type_words->push_back("Vector2"); diff --git a/core/object/script_language.h b/core/object/script_language.h index 59a43a7b297..04e8086ab03 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -185,17 +185,6 @@ public: Script() {} }; -class ScriptCodeCompletionCache { - static ScriptCodeCompletionCache *singleton; - -public: - static ScriptCodeCompletionCache *get_singleton() { return singleton; } - - ScriptCodeCompletionCache(); - - virtual ~ScriptCodeCompletionCache() {} -}; - class ScriptLanguage : public Object { GDCLASS(ScriptLanguage, Object) diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index c51eb44aee4..eb3c47fe7fa 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -279,69 +279,6 @@ void ScriptEditorBase::_bind_methods() { ADD_SIGNAL(MethodInfo("go_to_method", PropertyInfo(Variant::OBJECT, "script"), PropertyInfo(Variant::STRING, "method"))); } -class EditorScriptCodeCompletionCache : public ScriptCodeCompletionCache { - struct Cache { - uint64_t time_loaded = 0; - Ref cache; - }; - - HashMap cached; - -public: - uint64_t max_time_cache = 5 * 60 * 1000; //minutes, five - uint32_t max_cache_size = 128; - - void cleanup() { - List to_clean; - - HashMap::Iterator I = cached.begin(); - while (I) { - if ((OS::get_singleton()->get_ticks_msec() - I->value.time_loaded) > max_time_cache) { - to_clean.push_back(I->key); - } - ++I; - } - - while (to_clean.front()) { - cached.erase(to_clean.front()->get()); - to_clean.pop_front(); - } - } - - virtual Ref get_cached_resource(const String &p_path) { - HashMap::Iterator E = cached.find(p_path); - if (!E) { - Cache c; - c.cache = ResourceLoader::load(p_path); - E = cached.insert(p_path, c); - } - - E->value.time_loaded = OS::get_singleton()->get_ticks_msec(); - - if (cached.size() > max_cache_size) { - uint64_t older; - HashMap::Iterator O = cached.begin(); - older = O->value.time_loaded; - HashMap::Iterator I = O; - while (I) { - if (I->value.time_loaded < older) { - older = I->value.time_loaded; - O = I; - } - ++I; - } - - if (O != E) { //should never happen.. - cached.remove(O); - } - } - - return E->value.cache; - } - - virtual ~EditorScriptCodeCompletionCache() {} -}; - void ScriptEditorQuickOpen::popup_dialog(const Vector &p_functions, bool p_dontclear) { popup_centered_ratio(0.6); if (p_dontclear) { @@ -3989,7 +3926,6 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { script_editor_cache.instantiate(); script_editor_cache->load(EditorPaths::get_singleton()->get_project_settings_dir().path_join("script_editor_cache.cfg")); - completion_cache = memnew(EditorScriptCodeCompletionCache); restoring_layout = false; waiting_update_names = false; pending_auto_reload = false; @@ -4334,10 +4270,6 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { _update_online_doc(); } -ScriptEditor::~ScriptEditor() { - memdelete(completion_cache); -} - void ScriptEditorPlugin::_focus_another_editor() { if (window_wrapper->get_window_enabled()) { ERR_FAIL_COND(last_editor.is_empty()); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 9db1aff76ac..4a8919d2924 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -396,8 +396,6 @@ class ScriptEditor : public PanelContainer { void _update_selected_editor_menu(); - EditorScriptCodeCompletionCache *completion_cache = nullptr; - void _editor_stop(); int edit_pass; @@ -577,7 +575,6 @@ public: static void register_create_script_editor_function(CreateScriptEditorFunc p_func); ScriptEditor(WindowWrapper *p_wrapper); - ~ScriptEditor(); }; class ScriptEditorPlugin : public EditorPlugin {