From 6b1b3fbfa5d8a3fc4b58e7b84b0d358cc65a0f81 Mon Sep 17 00:00:00 2001 From: Jonas Rudlang Date: Thu, 22 May 2014 00:01:11 +0200 Subject: [PATCH] Added a setting to disable autocomplete popup and fixed the autocomplete timer to updated when the setting has changed --- tools/editor/code_editor.cpp | 14 +++++++++++--- tools/editor/code_editor.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index 734bf48975d..d86e48f74e6 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -484,8 +484,8 @@ void CodeTextEditor::_text_changed() { } void CodeTextEditor::_code_complete_timer_timeout() { - - text_editor->query_code_comple(); + if (enable_complete_timer) + text_editor->query_code_comple(); } void CodeTextEditor::_complete_request(const String& p_request, int p_line) { @@ -534,7 +534,12 @@ void CodeTextEditor::_on_settings_change() { text_editor->set_auto_brace_completion( EDITOR_DEF("text_editor/auto_brace_complete", false) ); - + + code_complete_timer->set_wait_time( + EDITOR_DEF("text_editor/code_complete_delay",.3f) + ); + + enable_complete_timer = EDITOR_DEF("text_editor/enable_code_completion_delay",true); } void CodeTextEditor::_text_changed_idle_timeout() { @@ -584,6 +589,8 @@ CodeTextEditor::CodeTextEditor() { code_complete_timer = memnew(Timer); add_child(code_complete_timer); code_complete_timer->set_one_shot(true); + enable_complete_timer = EDITOR_DEF("text_editor/enable_code_completion_delay",true); + code_complete_timer->set_wait_time(EDITOR_DEF("text_editor/code_complete_delay",.3f)); error = memnew( Label ); @@ -604,6 +611,7 @@ CodeTextEditor::CodeTextEditor() { cs.push_back("."); text_editor->set_completion(true,cs); idle->connect("timeout", this,"_text_changed_idle_timeout"); + code_complete_timer->connect("timeout", this,"_code_complete_timer_timeout"); EditorSettings::get_singleton()->connect("settings_changed",this,"_on_settings_change"); diff --git a/tools/editor/code_editor.h b/tools/editor/code_editor.h index 2ca2ae98732..1804237f18b 100644 --- a/tools/editor/code_editor.h +++ b/tools/editor/code_editor.h @@ -129,6 +129,7 @@ class CodeTextEditor : public Control { Label *info; Timer *idle; Timer *code_complete_timer; + bool enable_complete_timer; Label *error;